Message Boards Message Boards

Bode Plot - Customization of axis

Posted 1 year ago

Hello,

I would like to be able to plot the Bode diagrams of magnitude and phase in the following way in Mathematica (actually as it is shown in the following example of plotting the Bode diagram in Matlab):
enter image description here

enter image description here

It seems that Mathematica plots according to w, and not to frequency. w=2pi*freq How can I make the Bode Plot in Mathematica look the same as it looks in Matlab Bode Plot?

Wolfram Mathematica 12.0 file attached.

Thank you.

Attachments:
POSTED BY: Cornel B.
2 Replies

Looks like it's not easy to fix this. See here and here for more info ?

I have only this:

 H = (0.31831 (1 + 7.95775*10^-8 s))/(1 + 7.95775*10^-8 s + 2.53303*10^-14 s^2);
 BodePlot[TransferFunctionModel[{H}, s], {w, 10^1, 10^7}, 
  PlotRange -> {{-20, 15}, {10, -20}}, GridLines -> Automatic, 
  FrameLabel -> {{"", 
     HoldForm[Text[Magnitude[dB]]]}, {HoldForm[Text[Frequency[Hz]]], 
     HoldForm[Text[Phase [Radian]]]}}, 
  ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Radian"}}]
 (* Or: *)
 BodePlot[TransferFunctionModel[{H}, s], {w, 10^1, 10^7}, 
   PlotRange -> {{-20, 15}, {10, -20}}, GridLines -> Automatic, 
   FrameLabel -> {{"", 
      HoldForm[Text[Magnitude[dB]]]}, {HoldForm[Text[Frequency[Hz]]], 
      HoldForm[Text[Phase [deg]]]}}, 
   ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}]

Regards M.I.

POSTED BY: Mariusz Iwaniuk
Posted 1 year ago

The code that you posted does not change the display of the frequency axis from w to frequency (w being equal to 2pifreq (w=2pifreq)) - but at least it displays Magnitude[dB], Phase[deg], and Frequency[Hz] as text on the graphs. Anyway, I found how to do it:

H = (0.31831 (1 + 7.95775*10^-8 s))/(1 + 7.95775*10^-8 s + 2.53303*10^-14 s^2)
H = TransferFunctionModel[{H}, s]
BodePlot[H[I*2*\[Pi]*f], {f, 10^1, 1.5*10^6}, GridLines -> Automatic, 
 PlotRange -> {{-20, 15}, {10, -20}}, Frame -> False]

enter image description here enter image description here

POSTED BY: Cornel B.
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