I have an array of transfer functions and plotted multiple Bode plot. Now I need to add a horizontal line to show where all these Bode plots attain a gain of -8db. I know that previously people replied similar type of questions for drawing vertical line. But it seems that the same method is not working for horizontal lines? I also tried to draw a separate line and then used Show with the Bode plot diagram. But it didn't work. To summarise, what I am looking for is shown in this image. - I am trying to draw the black lines and mark the intersection points with different marker colours.
Could somebody help please?
2 Answers
This is a LogLinearPlot
. Let's use an example plot from the documentation and draw lines over it.
Ra[f_] := (
12200^2 f^4)/((f^2 +
20.6^2) Sqrt[(f^2 + 107.7^2) (f^2 + 737.9^2)] (f^2 + 12200^2))
LogLinearPlot[Ra[f], {f, 10, 10^5}, GridLines -> Automatic
, Epilog -> {
{Thick, Black, Line[{{Log[1000], 0}, {Log[1000], Ra[10^3]}}]}
, {Thick, Red, Line[{{Log[10^1], Ra[10^3]}, {Log[1000], Ra[10^3]}}]}
, {AbsolutePointSize[8], Darker@Green, Point[{Log[1000], Ra[10^3]}]}
}
]
If you have a more specific question, you can update your post and present a minimal example featuring copy-paste-able Mathematica code.
-
$\begingroup$ Hi Syed, Thank you so much. Here is the transfer function: TF = TransferFunctionModel[{{{ 1.8831584343714116
*^9 + 91654.79372668632 s}}, 2.3314280115350676
*^9 + 134019.32322803652` s + 1. s^2}, s]. I would like to have the green point at your example at (34453.1, -8.5193} and draw the black and red lines in your example from that point. $\endgroup$– km3May 11, 2022 at 18:57
Use the GridLines
option, and Mesh
also if needed.
tfm = TransferFunctionModel[{{{1.8831584343714116*^9 + 91654.79372668632 s}},
2.3314280115350676*^9 + 134019.32322803652` s + 1. s^2}, s];
pt = 10^5;
BodePlot[tfm, PlotLayout -> "Magnitude", Mesh -> {{pt}},
MeshStyle -> Directive[PointSize[Large], Green],
GridLines -> {{pt}, {20 Log10@Abs[tfm[I pt]][[1, 1]]}},
GridLinesStyle -> {Directive[Black, Thick], Directive[Red, Thick]}]
-
1$\begingroup$ Dear Suba, thank you so much. Really appreciate. $\endgroup$– km3May 19, 2022 at 15:19