Main Content

bodeoptions

Plot options for bodeplot

Description

Use the bodeoptions function to create a BodeOptions object to customize Bode plot appearance. Use this object to customize the appearance of a Bode plot created using bodeplot and override the plot preferences for the MATLAB® session in which you create the Bode plot.

The options you specify for a BodeOptions object correspond to properties of a BodePlot (Control System Toolbox) chart object.

Creation

Description

plotoptions = bodeoptions returns a default set of plot options for use with bodeplot. You can use these options to customize the Bode plot appearance using the command line. This syntax is useful when you want to write a script to generate plots that look the same regardless of the preference settings of the MATLAB session in which you run the script.

example

plotoptions = bodeoptions("cstprefs") initializes the plot options with the options you selected in the Control System Toolbox™ and System Identification Toolbox™ preferences editor. For more information about the editor, see Specify Toolbox Preferences for Linear Analysis Plots. This syntax is useful when you want to change a few plot options but otherwise use your default preferences. A script that uses this syntax can generate results that look different when run in a session with different preferences.

Properties

expand all

Response

Option to display magnitude plot, specified as either 'on' or 'off'.

This option corresponds to the MagnitudeVisible property of the chart object.

Option to display phase plot, specified as either 'on' or 'off'.

This option corresponds to the PhaseVisible property of the chart object.

Lower magnitude limit mode, specified as either 'auto' or 'manual'.

This option corresponds to the MinimumGainEnabled property of the chart object.

Lower magnitude limit value, specified as a scalar.

This option corresponds to the MinimumGainValue property of the chart object.

Number of standard deviations to use to plot the confidence region, specified as a scalar. This option is applicable to identified models only.

This option corresponds to the Characteristics.ConfidenceRegion.NumberOfStandardDeviations property of the chart object.

Dependencies

This option is supported only for identified models.

Units and Scaling

Frequency units, specified as one of the following values:

  • 'Hz'

  • 'rad/s'

  • 'rpm'

  • 'kHz'

  • 'MHz'

  • 'GHz'

  • 'rad/nanosecond'

  • 'rad/microsecond'

  • 'rad/millisecond'

  • 'rad/minute'

  • 'rad/hour'

  • 'rad/day'

  • 'rad/week'

  • 'rad/month'

  • 'rad/year'

  • 'cycles/nanosecond'

  • 'cycles/microsecond'

  • 'cycles/millisecond'

  • 'cycles/hour'

  • 'cycles/day'

  • 'cycles/week'

  • 'cycles/month'

  • 'cycles/year'

You can also specify 'auto' which uses frequency 'rad/TimeUnit', where TimeUnit is the TimeUnit property of the input system.

This option corresponds to the FrequencyUnit property of the chart object.

Frequency scale, specified as either 'log' or 'linear'.

This option corresponds to the FrequencyScale property of the chart object.

Magnitude units, specified as one of the following:

  • 'dB' — Decibels

  • 'abs' — Absolute value

This option corresponds to the MagnitudeUnit property of the chart object.

Magnitude scale, specified as either 'log' or 'linear'.

This option corresponds to the MagnitudeScale property of the chart object.

Phase units, specified as one of the following:

  • 'deg' — Degrees

  • 'rad' — Radians

This option corresponds to the PhaseUnit property of the chart object.

Phase Wrapping and Matching

Option to enable phase wrapping, specified as either 'off' or 'on'. When phase wrapping is enabled, the phase shown in the response wraps to remain in the range defined by PhaseWrappingBranch.

When both phase wrapping and phase matching are enabled, the software performs the phase matching followed by the phase wrapping.

This option corresponds to the PhaseWrappingEnabled property of the chart object.

Lower limit of phase-wrapping range, specified as a scalar value in degrees. The phase-wrapping range is [B,B+360), where B is equal to PhaseWrappingBranch.

This option corresponds to the PhaseWrappingBranch property of the chart object.

Option to enable phase matching, specified as either 'off' or 'on'. When phase matching is enabled, the phase response matches the value specified in PhaseMatchingValue at the frequency specified in PhaseMatchingFreq. The remaining phase response shifts to maintain the same phase profile.

This option corresponds to the PhaseMatchingEnabled property of the chart object.

When both phase wrapping and phase matching are enabled, the software performs the phase matching followed by the phase wrapping.

Phase matching frequency, specified as a scalar.

This option corresponds to the PhaseMatchingFrequency property of the chart object.

Phase matching response value, specified as a scalar.

This option corresponds to the PhaseMatchingValue property of the chart object.

Inputs and Outputs

Grouping of input-output (I/O) pairs, specified as one of the following:

  • 'none' — Do not group inputs or outputs.

  • 'inputs' — Group only inputs.

  • 'outputs' — Group only outputs.

  • 'all' — Group all input-output pairs.

This option corresponds to the IOGrouping property of the chart object.

Input label style, specified as a structure with the following fields:

  • FontSize — Font size, specified as a scalar value greater than zero in point units. The default font size depends on the specific operating system and locale. One point equals 1/72 inch.

  • FontWeight — Character thickness, specified as 'Normal' or 'bold'. MATLAB uses the FontWeight property to select a font from those available on your system. Not all fonts have a bold weight. Therefore, specifying a bold font weight can still result in the normal font weight.

  • FontAngle — Character slant, specified as 'Normal' or 'italic'. Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.

  • Color — Text color, specified as an RGB triplet. The default color is dark grey with the RGB triplet [0.4,0.4,0.4].

  • Interpreter — Text interpreter, specified as one of these values:

    • 'tex' — Interpret characters using a subset of TeX markup. This is the default value of Interpreter.

    • 'latex' — Interpret characters using LaTeX markup.

    • 'none' — Display literal characters.

This option corresponds to the InputLabels property of the chart object.

Output label style, specified as a structure with the following fields:

  • FontSize — Font size, specified as a scalar value greater than zero in point units. The default font size depends on the specific operating system and locale. One point equals 1/72 inch.

  • FontWeight — Character thickness, specified as 'Normal' or 'bold'. MATLAB uses the FontWeight property to select a font from those available on your system. Not all fonts have a bold weight. Therefore, specifying a bold font weight can still result in the normal font weight.

  • FontAngle — Character slant, specified as 'Normal' or ''italic'. Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.

  • Color — Text color, specified as an RGB triplet. The default color is dark grey with the RGB triplet [0.4,0.4,0.4].

  • Interpreter — Text interpreter, specified as one of these values:

    • 'tex' — Interpret characters using a subset of TeX markup. This is the default value of Interpreter.

    • 'latex' — Interpret characters using LaTeX markup.

    • 'none' — Display literal characters.

This option corresponds to the OutputLabels property of the chart object.

Option to display inputs, specified as {'on'}, {'off'}, or a cell array with multiple elements.

This option corresponds to the InputVisible property of the chart object.

Option to display outputs, specified as {'on'}, {'off'}, or a cell array with multiple elements.

This option corresponds to the OutputVisible property of the chart object.

Title and Axis Labels

Title text and style, specified as a structure with the following fields:

  • String — Label text, specified as a character vector. By default, the plot is titled 'Bode Diagram'.

  • FontSize — Font size, specified as a scalar value greater than zero in point units. The default font size depends on the specific operating system and locale. One point equals 1/72 inch.

  • FontWeight — Character thickness, specified as 'Normal' or 'bold'. MATLAB uses the FontWeight property to select a font from those available on your system. Not all fonts have a bold weight. Therefore, specifying a bold font weight can still result in the normal font weight.

  • FontAngle — Character slant, specified as 'Normal' or 'italic'. Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.

  • Color — Text color, specified as an RGB triplet. The default color is black specified by the RGB triplet [0,0,0].

  • Interpreter — Text interpreter, specified as one of these values:

    • 'tex' — Interpret characters using a subset of TeX markup. This is the default value of Interpreter.

    • 'latex' — Interpret characters using LaTeX markup.

    • 'none' — Display literal characters.

This option corresponds to the Title property of the chart object.

X-axis label text and style, specified as a structure with the following fields:

  • String — Label text, specified as a character vector. By default, the axis is titled based on the frequency units FreqUnits.

  • FontSize — Font size, specified as a scalar value greater than zero in point units. The default font size depends on the specific operating system and locale. One point equals 1/72 inch.

  • FontWeight — Character thickness, specified as 'Normal' or 'bold'. MATLAB uses the FontWeight property to select a font from those available on your system. Not all fonts have a bold weight. Therefore, specifying a bold font weight can still result in the normal font weight.

  • FontAngle — Character slant, specified as 'Normal' or 'italic'. Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.

  • Color — Text color, specified as an RGB triplet. The default color is black specified by the RGB triplet [0,0,0].

  • Interpreter — Text interpreter, specified as one of these values:

    • 'tex' — Interpret characters using a subset of TeX markup. This is the default value of Interpreter.

    • 'latex' — Interpret characters using LaTeX markup.

    • 'none' — Display literal characters.

This option corresponds to the XLabel property of the chart object.

Y-axis label text and style, specified as a structure with the following fields:

  • String — Label text, specified as a cell array of character vectors. By default, the axis label is a 1x2 cell array with 'Magnitude' and 'Phase'.

  • FontSize — Font size, specified as a scalar value greater than zero in point units. The default font size depends on the specific operating system and locale. One point equals 1/72 inch.

  • FontWeight — Character thickness, specified as 'Normal' or 'bold'. MATLAB uses the FontWeight property to select a font from those available on your system. Not all fonts have a bold weight. Therefore, specifying a bold font weight can still result in the normal font weight.

  • FontAngle — Character slant, specified as 'Normal' or 'italic'. Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.

  • Color — Text color, specified as an RGB triplet. The default color is black specified by the RGB triplet [0,0,0].

  • Interpreter — Text interpreter, specified as one of these values:

    • 'tex' — Interpret characters using a subset of TeX markup. This is the default value of Interpreter.

    • 'latex' — Interpret characters using LaTeX markup.

    • 'none' — Display literal characters.

This option corresponds to the YLabel property of the chart object.

Tick label style, specified as a structure with the following fields:

  • FontSize — Font size, specified as a scalar value greater than zero in point units. The default font size depends on the specific operating system and locale. One point equals 1/72 inch.

  • FontWeight — Character thickness, specified as 'Normal' or 'bold'. MATLAB uses the FontWeight property to select a font from those available on your system. Not all fonts have a bold weight. Therefore, specifying a bold font weight can still result in the normal font weight.

  • FontAngle — Character slant, specified as 'Normal' or 'italic'. Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.

  • Color — Text color, specified as an RGB triplet. The default color is black specified by the RGB triplet [0,0,0].

Grid

Toggle grid display on the plot, specified as either 'off' or 'on'.

This option corresponds to the GridVisible property of the chart object.

Color of the grid lines, specified as an RGB triplet. The default color is light grey specified by the RGB triplet [0.15 0.15 0.15].

Axis Limits

X-axis limit selection mode, specified as one of the following values:

  • 'auto' — Enable automatic limit selection, which is based on the total span of the plotted data.

  • 'manual' — Manually specify the axis limits. To specify the axis limits, set the XLim option.

This option corresponds to the XLimitsMode property of the chart object.

Selection mode for the y-axis limits, specified as one of these values:

  • 'auto' — Enable automatic limit selection, which is based on the total span of the plotted data.

  • 'manual' — Manually specify the axis limits. To specify the axis limits, set the YLim option.

This option corresponds to the YLimitsMode property of the chart object.

X-axis limits, specified as a cell array of two-element vector of the form [min,max].

This option corresponds to the XLimits property of the chart object.

Y-axis limits, specified as a cell array of two-element vector of the form [min,max].

This option corresponds to the YLimits property of the chart object.

Object Functions

bodeplotPlot Bode frequency response of dynamic system

Examples

collapse all

For this example, create a Bode plot that uses 15-point red text for the title and sets a custom title. When you specify plot properties explicitly using bodeoptions, the specified properties override the MATLAB session preferences. Thus, the plot looks the same regardless of the preferences of the MATLAB session in which it is generated.

First, create a default options set using bodeoptions.

opts = bodeoptions;

Next, change the required properties of the options set opts. Because opt.Title is a structure, specify the properties of the plot title by specifying the fields and values of that structure.

opts.Title.FontSize = 15;
opts.Title.Color = [1 0 0];
opts.Title.String = 'System Frequency Response';
opts.FreqUnits = 'Hz';

Now, create a Bode plot using the options set opts.

bodeplot(tf(1,[1,1]),opts);

MATLAB figure

Because opts begins with a fixed set of options, the plot result is independent of the toolbox preferences of the MATLAB session.

Version History

Introduced in R2012a