TransferFunction.Plot.plotBode(dtf) or TransferFunction.Plot.plotBode(dtf, nPoints, autoRange, f_min, f_max, magnitude=true, phase=true, defaultDiagram=Modelica_LinearSystems2.Internal.DefaultDiagramBodePlot(), device=Modelica_LinearSystems2.Utilities.Plot.Records.Device() )
This function plots the bode-diagram of a transfer function.
TransferFunction s = Modelica_LinearSystems2.TransferFunction.s(); Modelica_LinearSystems2.TransferFunction tf =(s^2 + 5*s + 7)/(s^2 + 5*s + 6); algorithm Modelica_LinearSystems2.TransferFunction.Plot.plotBode(tf) // gives:
encapsulated function bode import Modelica; import Modelica.Utilities.Strings; import Modelica.ComplexMath; import Complex; import Modelica_LinearSystems2; import Modelica_LinearSystems2.Internal; import Modelica_LinearSystems2.TransferFunction; import Modelica_LinearSystems2.WorkInProgress.DiscreteTransferFunction; import Modelica_LinearSystems2.Utilities.Plot; import Modelica.Units.SI; input DiscreteTransferFunction dtf "DiscreteTransfer function to be plotted"; input Integer nPoints(min = 2) = 200 "Number of points"; input Boolean autoRange = true "True, if abszissa range is automatically determined"; input SI.Frequency f_min(min = 0) = 0.1 "Minimum frequency value, if autoRange = false" annotation( Dialog(enable = not autoRange)); input SI.Frequency f_max(min = 0) = 10 "Maximum frequency value, if autoRange = false" annotation( Dialog(enable = not autoRange)); input Boolean magnitude = true "= true, to plot the magnitude of tf" annotation( choices(checkBox = true)); input Boolean phase = true "= true, to plot the phase of tf" annotation( choices(checkBox = true)); extends Modelica_LinearSystems2.Internal.PartialPlotFunction(defaultDiagram = Modelica_LinearSystems2.Internal.DefaultDiagramBodePlot(heading = "Bode plot of dtf = " + String(dtf))); end bode;