# What does BodePlot actually calculate?

I'm using Mathematica v12.3 student edition, running on Windows 10 Home (AMD Ryzen 5 4500U with Radeon Graphics 2.38 GHz).

I'm trying to get a Bode plot of an example function. I try to do it with the BodePlot function, to compare it with the result I obtained "directly" (meaning by calculating 20*Log10[Abs[..]] and plotting the results with LogLinearPlot).

function = TransferFunctionModel[1000/(1 + s/10), s];
functionF[f_] := 1000/(1 + (2 Pi I f)/10)

Show[BodePlot[function[I 2 Pi f], {f, 0.1, 10}, PlotStyle -> Red,
GridLines -> Automatic, FrameStyle -> Black,
FrameLabel -> {{"Frequenza [Hz]",
ImageSize -> Large][[1]][[1]],LogLinearPlot[20 *Log10[Abs[functionF[f]]], {f, 0.1, 10},PlotStyle -> Green, GridLines -> Automatic, FrameStyle -> Black, FrameLabel -> {{"Frequenza [rad Hz]",


The two graphs displayed above are different; I'm pretty sure, though, that what is being calculated with BodePlot (the magnitude graph) is 20*Log10 [Abs[ ...something]].

What am I missing?

• Added control-systems tag. Nov 7 '21 at 15:00

Your understanding of what BodePlot (with the default ScalingFunctions->{Automatic,"dB"}) computes is correct.

However, unfortunately, it 'hijacks' the Ticks attribute of plot-related functions to display it with the x-axis you see. As such, when you combine it with LogLinearPlot which itself uses a transformation function for its axes - they don't line up.

Here's a workaround/demonstration these are indeed identical by extracting the points from BodePlot:

functionF[f_] := 1000/(1 + (2 Pi I f)/10)
functionDB[f_] := 20 Log10[Abs[functionF[f]]]

bodePlot = BodePlot[functionF[f], {f, 0.1, 10}, PlotLayout -> "Magnitude"];
extractedBodePoints = Cases[bodePlot, Line[pts__] :> pts, Infinity][[1]];
extractedBodePoints = MapAt[10^# &, extractedBodePoints, {All, 1}];

equallySpacedFrequencyPoints = Power[10., Subdivide[-1, 1, 100]];