({{, (RefLink[BodePlot, paclet:ref/BodePlot])[lsys]
generates a Bode plot of a linear time-invariant system lsys.}, {, (RefLink[BodePlot, paclet:ref/BodePlot])[lsys,{(Subscript[ω, min]),(Subscript[ω, max])}]
plots for the frequency range (Subscript[ω, min]) to (Subscript[ω, max]).}, {, (RefLink[BodePlot, paclet:ref/BodePlot])[expr,{ω,(Subscript[ω, min]),(Subscript[ω, max])}]
plots expr using the variable ω.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[BodePlot, paclet:ref/BodePlot]) plots the magnitude and phase of the transfer function of lsys.

The system lsys can be (RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel]) or (RefLink[StateSpaceModel, paclet:ref/StateSpaceModel]), including descriptor and delay systems.

For a system lsys with the corresponding transfer function g(s), the following expressions are plotted:

(RefLink[BodePlot, paclet:ref/BodePlot]) treats the variable ω as local, effectively using (RefLink[Block, paclet:ref/Block]).

(RefLink[BodePlot, paclet:ref/BodePlot]) has the same options as (RefLink[Plot, paclet:ref/Plot]), with the following changes and additions:

Possible explicit settings for the option (RefLink[PlotLayout, paclet:ref/PlotLayout]) are "VerticalGrid" and "List".

The option (RefLink[PlotLayout, paclet:ref/PlotLayout]) accepts the following values:

The other options of (RefLink[BodePlot, paclet:ref/BodePlot]) can be specified as a list of two elements, with the first element corresponding to the magnitude plot and the second to the phase plot.

Option specifications include:

With the (RefLink[PlotLayout, paclet:ref/PlotLayout]) settings "Magnitude" or "Phase", a single setting refers to the plot requested.

The scaling functions can be specified as (RefLink[ScalingFunctions, paclet:ref/ScalingFunctions])->{{magfreqscale,magscale},{phasefreqscale,phasescale}}.

The frequency scales magfreqscale and phasefreqscale can be "Log10" or "Linear", which correspond to the base-10 logarithmic scale and linear scale, respectively.

The magnitude scale magscale can be "dB" or "Absolute", which correspond to the decibel and absolute values of the magnitude, respectively.

The phase scale phasescale can be "Degree" or "Radian".

OpenersPrimaryExamplesSection(Spacer1)Examples  (46)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

The Bode plot of a system:

BodePlot[(TransferFunctionModelFull[(20/(20+s)), , , ])]

A second-order system:

lsys[ω_,ζ_]:=(TransferFunctionModelFull[((ω^2)/((ω^2)+2 ζ ω s+(s^2))), , , ]);

Plot over an explicit frequency range:

BodePlot[lsys[1,1],{.01,100}]

Bode plot of a state-space model:

BodePlot[(StateSpaceModelFull[0, 1, 0, -0.5`, -0.05`, 1, 1, 0, 0, , , ])]

OpenersExampleSection1(Spacer1)Scope  (13)

Bode plot of a constant-gain system:

BodePlot[(TransferFunctionModelFull[10, , , ])]

Bode plot of an integrator:

BodePlot[(TransferFunctionModelFull[(1/s), , , ])]

Bode plot of a differentiator:

BodePlot[(TransferFunctionModelFull[s, , , ])]

Bode plot of a first-order lag:

BodePlot[(TransferFunctionModelFull[(1/(1+10 s)), , , ])]

Bode plot of a first-order lead:

BodePlot[(TransferFunctionModelFull[1+10 s, , , ])]

Bode plot of a second-order system:

BodePlot[(TransferFunctionModelFull[(100/(100+1.` s+(s^2))), , , ])]

A higher-order (RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel]):

BodePlot[(TransferFunctionModelFull[((5 (1+0.1` s))/(s+0.512` (s^2)+0.0064` (s^3)+0.0002` (s^4))), , , ])]

Bode plot of a time-delay system:

BodePlot[(TransferFunctionModelFull[((E^(-0.5` s))/(1.` +2.` s)), , , ])]

A discrete-time system:

BodePlot[(TransferFunctionModelFull[((-0.9`+z)/(-0.8`+z)), 1, , ])]

Specify the frequency range:

BodePlot[(TransferFunctionModelFull[((-4+4.9` z)/((-4.5`+z) (-1+z))), 1, , ]),{0.05,(π/2)}]

The Bode plot of a state-space model:

BodePlot[(StateSpaceModelFull[-1, 10, 0, 0, -2, -7, 335, 0, 0, 0, -10, 10, 1, 0, 0, 0, , , ])]

A system specified using its sinusoidal transfer function:

BodePlot[(10/(20ω I+1)),{ω,0.0005,10}]

The Bode plot of a multiple-input, multiple-output system:

BodePlot[(TransferFunctionModelFull[(2/(1+s)), (1/(2+s)), ((0.5`)/(3+s)), ((0.1`)/(4+s)), , , ])]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

(RefLink[BodePlot, paclet:ref/BodePlot])[(RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel])[g,var]] is equivalent to (RefLink[BodePlot, paclet:ref/BodePlot])[g]:

g=(12/(9+0.48s+(s^2)));

{BodePlot[g],BodePlot[TransferFunctionModel[g,s]]}

OpenersExampleSection3(Spacer1)Options  (21)

OpenersExampleSubsection0(Spacer1)CoordinatesToolOptions  (5)

To obtain coordinates, select the graphics and press the period key:

BodePlot[(TransferFunctionModelFull[(2500/(15500+400 s+(s^2))), , , ])]

If frequency is in rad/s, obtain coordinate frequency values in hertz by dividing it by 2 π:

BodePlot[(TransferFunctionModelFull[(4/(4+2 s+(s^2))), , , ]),CoordinatesToolOptions->("DisplayFunction"->Function[pt,{((pt[[1]])/(2 π)),pt[[2]]}])]

Coordinate frequency values in different units for each plot:

BodePlot[(TransferFunctionModelFull[(16/((1+s) (((4+s))^2))), , , ]),CoordinatesToolOptions-> {"DisplayFunction"->Function[pt,{((pt[[1]])/(2 π)),pt[[2]]}]}]

Frequency values in original units, magnitude in absolute units, and phase in radians:

BodePlot[(TransferFunctionModelFull[(5/(s (10+6 s+(s^2)))), , , ]),CoordinatesToolOptions-> {{"DisplayFunction"->Function[pt,{pt[[1]],(10^((pt[[2]])/20))}]},{"DisplayFunction"->Function[pt,{pt[[1]],pt[[2]] Degree}]}}]

Specify radians as both the displayed and copied value of phase:

BodePlot[(TransferFunctionModelFull[((100 s)/(1+s)), , , ]),CoordinatesToolOptions->{Automatic,{"DisplayFunction"->Function[pt,{pt[[1]],pt[[2]] Degree}],"CopiedValueFunction"->Function[pt,{pt[[1]],pt[[2]]Degree}]}}]

OpenersExampleSubsection1(Spacer1)GridLines  (3)

Show grid lines:

BodePlot[(TransferFunctionModelFull[((1.6`)/(1.6` +3 s+(s^2))), , , ]),GridLines->Automatic]

Show grid lines only on the magnitude plot:

BodePlot[(TransferFunctionModelFull[(10/((2+s) (4+s) (6+s))), , , ]),GridLines->{Automatic,None}]

Show specific grid lines:

BodePlot[(TransferFunctionModelFull[(1/((s^2) (3+s+(s^2)))), , , ]),GridLines->{{List[0.01,0.1,1,10],Range[-150,140,20]}, {List[0.01,0.1,1,10],Range[0,200,25]}}]

OpenersExampleSubsection2(Spacer1)GridLinesStyle  (2)

Specify grid lines style:

BodePlot[(TransferFunctionModelFull[(1/(10+3 s+(s^3))), , , ]),GridLines->Automatic,GridLinesStyle->Red]

Specify different grid lines styles:

BodePlot[(TransferFunctionModelFull[((1+s)/(s (2+s) (3+s))), , , ]),GridLines->Automatic,GridLinesStyle->{{Green,Black},{Red,Black}}]

OpenersExampleSubsection3(Spacer1)PhaseRange  (1)

The phase is typically plotted as a continuous function:

BodePlot[(1/((((s+1))^4)(s+5))),PlotLayout->"Phase"]

Specify a phase range:

BodePlot[(1/((((s+1))^4)(s+5))),PlotLayout->"Phase",PhaseRange->{-2 π,0}]

OpenersExampleSubsection4(Spacer1)PlotLayout  (1)

By default, the magnitude plot is placed vertically above the phase plot:

tfm=(TransferFunctionModelFull[((-5+s)/(s (1+3 s+(s^2)))), , , ]);

BodePlot[tfm,PlotLabel->{"Magnitude Plot","Phase Plot"}]

Obtain the result in a list:

BodePlot[tfm,PlotLayout->"List",PlotLabel->{"Magnitude Plot","Phase Plot"}]

Only the magnitude plot:

BodePlot[tfm,PlotLayout->"Magnitude"]

Only the phase plot:

BodePlot[tfm,PlotLayout->"Phase"]

OpenersExampleSubsection5(Spacer1)PlotTheme  (2)

Use a theme with simple ticks and grid lines in a bright color scheme:

BodePlot[(TransferFunctionModelFull[(20/(20+s)), , , ]),PlotTheme->"Business"]

Change the color scheme:

BodePlot[(TransferFunctionModelFull[(20/(20+s)), , , ]),PlotTheme->"Business",PlotStyle->56]

OpenersExampleSubsection6(Spacer1)SamplingPeriod  (2)

Specify the sampling period in the system description:

tfm=(TransferFunctionModelFull[((0.5`)/((-0.1`+z) (z^2))), 1, , ]);

BodePlot[tfm,{0.1,Pi}]

Specify the sampling period in the (RefLink[BodePlot, paclet:ref/BodePlot]) function:

BodePlot[(5/((-0.1+z) (z^2))),{0.1,π},SamplingPeriod->1]

A smaller sampling period results in a higher bandwidth:

BodePlot[(5/((-0.1+z) (z^2))),{0.1,π},SamplingPeriod->0.5]

OpenersExampleSubsection7(Spacer1)ScalingFunctions  (2)

Show absolute values of magnitude and phase in radians:

BodePlot[(TransferFunctionModelFull[(1/((1+s) (1+10 s))), , , ]),{0.1,10},ScalingFunctions->{{Automatic,"Absolute"},{Automatic,"Radian"}}]

Plot frequency in the linear scale:

BodePlot[(TransferFunctionModelFull[((1+s)/(1+5 s+(s^2))), , , ]),{0.1,10}, ScalingFunctions->{{"Linear",Automatic},{"Linear",Automatic}}]

OpenersExampleSubsection8(Spacer1)StabilityMargins  (2)

Show stability margins:

BodePlot[(TransferFunctionModelFull[(50/((2+s) (3+s) (8+s))), , , ]),StabilityMargins->True]

Show the phase margin only:

BodePlot[(TransferFunctionModelFull[(50/((2+s) (3+s) (8+s))), , , ]),StabilityMargins->{False,True}]

OpenersExampleSubsection9(Spacer1)StabilityMarginsStyle  (1)

Specify the stability margins style:

BodePlot[(TransferFunctionModelFull[(10000/((5+s) (20+s) (50+s))), , , ]),{0.1,100},StabilityMargins->True,StabilityMarginsStyle->{Green,Directive[Red,Dashed]}]

OpenersExampleSection4(Spacer1)Applications  (7)

The static position error constant of a type 0 system is the magnitude at steady state:

BodePlot[(TransferFunctionModelFull[(10/(1+s)), , , ]),{0.001,10},Epilog->{PointSize[Medium],Red,Point[{Log10[0.001],20 Log10[Limit[(10/(s+1)),s->0]]}]},PlotRange->{{0.0008,10},Automatic},PlotLayout->"Magnitude",Frame->False]

Discrete-time type 0 system:

BodePlot[(TransferFunctionModelFull[(z/((-0.6`+z) (-0.05`+z))), 0.5`, , ]) ,{0.001,(π/0.5)},Epilog->{PointSize[Medium],Red,Point[{Log10[0.001],20 Log10[Limit[(z/((z-0.05) (z-0.6))),z->1]]}]},PlotRange->{{0.0008,(π/0.5)},Automatic},PlotLayout->"Magnitude",Frame->False]

The static velocity error constant of a type 1 system is approximately the intersection of the initial -20 dB/decade segment (or its extension) with the 0 dB line:

BodePlot[(TransferFunctionModelFull[(5/(s (3+s))), , , ]),{0.1,100},Epilog->{Line[{{Log10[0.1],0},{Log10[100],0}}],PointSize[Medium],Red,Point[{ Log10[Limit[s ((5 )/(s(s+3))),s->0]],0}]},PlotLayout->"Magnitude",Frame->False]

Discrete-time type 1 system:

BodePlot[(TransferFunctionModelFull[(1/((-1+z) (-0.025`+z))), 1, , ]),{0.1,π},Epilog->{Line[{{Log10[0.1],0},{Log10[π],0}}],PointSize[Medium],Red,Point[{Log10[Limit[((z-1)/((z-1) (z-0.025))),z->1]],0}]},PlotLayout->"Magnitude",Frame->False]

The square root of the static acceleration error constant of a type 2 system is approximately the intersection of the initial -40 dB/decade segment (or its extension) with the 0 dB line:

BodePlot[(TransferFunctionModelFull[(1/((s^2) (1+s))), , , ]),{0.1,10},Epilog->{Line[{{Log10[0.1],0},{Log10[10],0}}],PointSize[Medium],Red,Point[{ Log10[(Sqrt[Limit[(s^2)(1/((s^2)(s+1))),s-> 0]])],0}]},PlotLayout->"Magnitude",Frame->False]

Discrete-time type 2 system:

BodePlot[(TransferFunctionModel[((0.0001 z)/((((-1+z))^2) (0.1-0.3 z+(z^2)))), 1]),{0.001,π},Epilog->{Line[{{Log10[0.001],0},{Log10[π],0}}],PointSize[Medium],Red,Point[{Log10[(Sqrt[Limit[(((((z-1))^2) (0.0001 z))/((((z-1))^2) ((z^2)-0.3 z+0.1))),z->1]])],0}]},PlotLayout->"Magnitude",Frame->False]

Visualize the improvement in phase margin by using a proportional-integral (PI) compensator:

BodePlot[{Tooltip[(TransferFunctionModelFull[(583900/(s (36+s) (100+s))), , , ])],Tooltip[(TransferFunctionModelFull[((36786 (0.98` +s))/(s (0.062` +s) (36+s) (100+s))), , , ])]},StabilityMargins->{True,True},StabilityMarginsStyle->{Red,Blue},PlotStyle->{Red,Blue},PlotLayout->"Phase",Frame->False]

Visualize the frequency response of a zero-order hold with sampling period 1:

BodePlot[(TransferFunctionModelFull[(((E^(-s)) (-1+(E^s)))/s), , , ]),{0.01,30},ScalingFunctions->{{"Linear","Absolute"},{"Linear","Degree"}},PlotRange->All]

Obtain the Bode plot with frequency in Hertz, when the Laplace variable is in radians/second:

tfm=(TransferFunctionModelFull[(100/(s (100+10 s+(s^2)))), , , ]);

BodePlot[tfm[I 2 π f],f]

For continuous-time systems, the same result can be obtained by scaling the Laplace variable:

BodePlot[tfm[2 π s]]

The plot in Hertz for a discrete-time system with the Z-transform variable in radians/second:

BodePlot[((-0.4+(E^(2 I f π)))/(0.5 +(E^(2 I f π)))),f,SamplingPeriod->1]

OpenersExampleSection5(Spacer1)Properties & Relations  (1)

(RefLink[SingularValuePlot, paclet:ref/SingularValuePlot]) generalizes the Bode magnitude plot to MIMO systems:

tfm=(TransferFunctionModelFull[(10000/((5+s) (20+s) (50+s))), , , ]);

{SingularValuePlot[tfm],BodePlot[tfm,PlotLayout->"Magnitude",Frame->False]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[NyquistPlot, paclet:ref/NyquistPlot])  ▪  (RefLink[NicholsPlot, paclet:ref/NicholsPlot])  ▪  (RefLink[SingularValuePlot, paclet:ref/SingularValuePlot])  ▪  (RefLink[GainPhaseMargins, paclet:ref/GainPhaseMargins])  ▪  (RefLink[TransferFunctionModel, paclet:ref/TransferFunctionModel])  ▪  (RefLink[AbsArgPlot, paclet:ref/AbsArgPlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Signal Processing, paclet:guide/SignalProcessing])}, {▪(RefLinkPlain[Fourier Analysis, paclet:guide/FourierAnalysis])}, {▪(RefLinkPlain[Classical Analysis and Design, paclet:guide/ClassicalAnalysisAndDesign])}, {▪(RefLinkPlain[Integral Transforms, paclet:guide/IntegralTransforms])}, {▪(RefLinkPlain[Control Systems, paclet:guide/ControlSystems])}, {▪(RefLinkPlain[Summation Transforms, paclet:guide/SummationTransforms])}, {▪(RefLinkPlain[Delay Control Systems, paclet:guide/DelayControlSystems])}, {▪(RefLinkPlain[System Model Analytics & Design, paclet:guide/SystemModelAnalyticsDesign])}})}})