Main Content

Plot Bode and Nyquist Plots at the Command Line

You can plot Bode and Nyquist plots for linear models using the bode and nyquist commands. If you want to customize the appearance of the plot, or turn on the confidence region programmatically, use bodeplot, and nyquistplot instead.

All plot commands have the same basic syntax, as follows:

  • To plot one model, use the syntax command(model).

  • To plot several models, use the syntax command(model1,model2,...,modelN).

In this case, command represents any of the plotting commands.

To display confidence intervals for a specified number of standard deviations, use the following syntax:

h=command(model);
showConfidence(h,sd)

where sd is the number of standard deviations of a Gaussian distribution and command is bodeplotor nyquistplot. For example, a confidence value of 99% for the nominal model curve corresponds to 2.58 standard deviations.

The following table summarizes commands that generate Bode and Nyquist plots for linear models. For detailed information about each command and how to specify the frequency values for computing the response, see the corresponding reference page.

CommandDescriptionExample
bode and bodeplot

Plots the magnitude and phase of the frequency response on a logarithmic frequency scale.

Note

Does not support time-series models.

To create the bode plot of the model, sys, use the following command:

bode(sys)
nyquist and nyquistplot

Plots the imaginary versus real part of the transfer function.

Note

Does not support time-series models.

To plot the frequency response of the model, sys, use the following command:

nyquist(sys)
spectrum and spectrumplotPlots the disturbance spectra of input-output models and output spectra of time series models.

To plot the output spectrum of a time series model, sys, with 1 standard deviation confidence region, use the following command:

showConfidence(spectrumplot(sys));

 More About