Skip to Main Content Skip to Search
Product Documentation

bodeplot - Plot Bode frequency response and return plot handle

Syntax

h = bodeplot(sys)
bodeplot(sys)
bodeplot(sys1,sys2,...)
bodeplot(AX,...)
bodeplot(..., plotoptions)
bodeplot(sys,w)

Description

h = bodeplot(sys) plot the Bode magnitude and phase of the dynamic system sys and returns the plot handle h to the plot. You can use this handle to customize the plot with the getoptions and setoptions commands.

bodeplot(sys) draws the Bode plot of the model sys. The frequency range and number of points are chosen automatically.

bodeplot(sys1,sys2,...) graphs the Bode response of multiple models sys1,sys2,... on a single plot. You can specify a color, line style, and marker for each model, as in

bodeplot(sys1,'r',sys2,'y--',sys3,'gx')

bodeplot(AX,...) plots into the axes with handle AX.

bodeplot(..., plotoptions) plots the Bode response with the options specified in plotoptions. Type

help bodeoptions 

for a list of available plot options. See Example 2 for an example of phase matching using the PhaseMatchingFreq and PhaseMatchingValue options.

bodeplot(sys,w) draws the Bode plot for frequencies specified by w. When w = {wmin,wmax}, the Bode plot is drawn for frequencies between wmin and wmax (in rad/TimeUnit, where TimeUnit is the time units of the input dynamic system, specified in the TimeUnit property of sys.). When w is a user-supplied vector w of frequencies, in rad/TimeUnit, the Bode response is drawn for the specified frequencies.

See logspace to generate logarithmically spaced frequency vectors.

Tips

You can change the properties of your plot, for example the units. For information on the ways to change properties of your plots, see Ways to Customize Plots.

Examples

Example 1

Use the plot handle to change options in a Bode plot.

sys = rss(5);
h = bodeplot(sys);
% Change units to Hz and make phase plot invisible
setoptions(h,'FreqUnits','Hz','PhaseVisible','off');

Example 2

The properties PhaseMatchingFreq and PhaseMatchingValue are parameters you can use to specify the phase at a specified frequency. For example, enter the following commands.

sys = tf(1,[1 1]); 
h = bodeplot(sys) % This displays a Bode plot.

Use this code to match a phase of 750 degrees to 1 rad/s.

p = getoptions(h); 
p.PhaseMatching = 'on'; 
p.PhaseMatchingFreq = 1; 
p.PhaseMatchingValue = 750; % Set the phase to 750 degrees at 1 
                            % rad/s.
setoptions(h,p); % Update the Bode plot.

The first bode plot has a phase of -45 degrees at a frequency of 1 rad/s. Setting the phase matching options so that at 1 rad/s the phase is near 750 degrees yields the second Bode plot. Note that, however, the phase can only be -45 + N*360, where N is an integer, and so the plot is set to the nearest allowable phase, namely 675 degrees (or 2*360 - 45 = 675).

See Also

bode | bodeoptions | getoptions | setoptions

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS