Message Boards Message Boards

How to combine BodePlot with imported data

Dear Everyone,
I am trying to combine the picture generated by BodePlot with simulated data points generated by Spice. When I use the function Show[], the BodePlot appears to be smaller than the data imported. I would like that all curves have same size in order to compare them.
     SetDirectory[NotebookDirectory[]];
 data = Import["opamp_model.txt", "Table"];
 x1y1 = data[[All, {1, 2}]];
 x1y2 = data[[All, {1, 3}]];
 M = ListLogLinearPlot[x1y1, ImageSize -> 550, Frame -> False,
   PlotStyle -> Directive[Thick, ColorData[20, 5]], Frame -> False,
   AspectRatio -> 1/2.25, GridLines -> Automatic,
   GridLinesStyle -> Directive[Dashed], PlotLabel -> "MAGNITUDE",
   AxesLabel -> {"Freq. (Hz)", "Mag. (db)"}]
P = ListLogLinearPlot[x1y2, ImageSize -> 550, Frame -> True,
   PlotStyle -> Directive[Thick, ColorData[20, 5]], Frame -> False,
   AspectRatio -> 1/2.25, GridLines -> Automatic,
   GridLinesStyle -> Directive[Dashed]];
BP = BodePlot[-((
   1.2*10^10*(s - 113*10^6) (s + 459*10^6))/((s + 0.98) (s +
      25.5*10^3) (s + 9.5*10^6) (s + 43*10^6))), ImageSize -> 550,
  Frame -> False, PlotStyle -> Directive[Thick, ColorData[20, 1]],
  Frame -> False, AspectRatio -> 1/2.25, GridLines -> Automatic,
  GridLinesStyle -> Directive[Dashed], PlotLayout -> "List",
  PlotLabel -> {"MAGNITUDE", "PHASE"},
  AxesLabel -> {{"Freq. (Hz)", "Mag. (db)"}, {"Freq. (Hz)",
     "Phase (degree)"}},
  ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}]
Show[Part[BP, 1], M, PlotRange -> Automatic]
Show[Part[BP, 2], P, PlotRange -> Automatic]    
Hi Francesco,
In general, if you can give out some real data, please do. It is not easy to help if the problem is not reproducible.
As you have specified in BodePlot, the scaling function is using Log10 while ListLogLinearPlot is actually using natural log. I am guessing this is the problem.
To workaround this, process x1y1 like:
{x,y} = Transpose[x1y1]; (* assuming x1y1 is two-dimensional data *)
M = ListLinePlot[ Transpose[{Log10[x], y}]]; (* there is no need to put options other than styles here since Show honors options of the first plot *)
Show[ Part[BP, 1], M]
Hope this helps.
POSTED BY: MinHsuan Peng
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract