Create Plot
Interactively create linear analysis response plots in the Live Editor
Since R2022b
Description
The Create Plot Live Editor task lets you
interactively create time-domain and frequency-domain analysis plots for dynamic system models
in your MATLAB® workspace. This page describes a subset of the functionality available in the
Create Plot
live task — the subset available when you select Control Toolbox
Plots
in the Filter by Category menu. For more
information about the task in general, see the Create Plot
Live Editor task reference page.
More
Supported plots
The Create Plot Live Editor task supports the following linear analysis response plots:
Open the Task
To add the Create Plot task to a live script in the MATLAB Live Editor:
On the Live Editor tab, click Task and select the Create Plot icon .
In a code block in the live script, type a relevant keyword, such as
bode
,step
,pzplot
, orimpulse
. Select Create Plot from the suggested command completions. When you add the task using this method, then MATLAB automatically selects the corresponding chart type in the Select visualization section of the task.
Examples
Interactively Create Bode Plot in the Live Editor
Use the Create Plot task in the Live Editor to interactively create and visualize different linear analysis plots. You can also use an options object from your MATLAB® workspace to customize your plot. Open this example to see a preconfigured script containing the Create Plot task to create a Bode plot.
For this example, consider the following SISO state-space model:
Create the SISO state-space model defined by the following state-space matrices:
A = [-1.5,-2;1,0]; B = [0.5;0]; C = [0,1]; D = 0; sys = ss(A,B,C,D);
To create a Bode plot of sys
, open the Create Plot task in the Live Editor. On the Live Editor tab, select Task > Create Plot. In the task, select Control Toolbox Plots
from the Filter by Category dropdown menu. You can also directly search for the plot type by typing in the plot name in the Select visualization field.
Next, select bodeplot from the available plots. If you do not have a supported model type in your MATLAB workspace, then the respective plot type will not be available.
Use the Dynamic System dropdown menu to pick the appropriate model from your MATLAB workspace. You can use the Frequencies dropdown menu to specify a vector of frequencies. You can also customize your plot by using a predefined options object. For more information, see bodeplot
.
For this example, pick sys
and leave the other options as default
.
You can also select the color, line style and marker symbol for the plot using the Select optional visualization parameters menu. You can click to add more visualization parameters. For this example, change the line color to green.
To see the code that this task generates, expand the task display by clicking Show code at the bottom of the task parameter area.
You can also overlay multiple visualizations on the same plot axis. For more information and examples, see the Create Plot task reference page.
Parameters
Dynamic System
— Model to create the linear analysis response plot
dynamic system model | model array
Choose the dynamic system model or model array to create the linear analysis response plot. Dynamic systems that you can use include:
Continuous-time or discrete-time numeric LTI models, such as
tf
,zpk
, orss
models.Generalized or uncertain LTI models such as
genss
oruss
(Robust Control Toolbox) models. (Using uncertain models requires Robust Control Toolbox™ software.)For tunable control design blocks, the task evaluates the model at its current value to plot the response data.
For uncertain control design blocks, the task plots the nominal value and random samples of the model.
Frequency-response data models such as
frd
models to plot the Bode, sigma, Nyquist or Nichols response. For such models, the task plots the response at frequencies defined in the model.Identified LTI models, such as
idtf
(System Identification Toolbox),idss
(System Identification Toolbox), oridproc
(System Identification Toolbox) models. (Using identified models requires System Identification Toolbox™ software.)
Note
You can only use a single model to plot Hankel singular values. For all other response plots, the task plots the responses of all models in the array on the same axes when you have an array of dynamic system models.
Plot Options
— Plot options set for customization
BodeOptions
object | SigmaOptions
object | NicholsOptions
object | NyquistOptions
object | TimeOptions
object | PZOptions
object | HSVOptions
object
Create and choose the correct options set based on the plot type as follows:
Plot Type | Options Object | Creation Function |
bodeplot | BodeOptions object | bodeoptions |
sigmaplot | SigmaOptions object | sigmaoptions |
nyquistplot | NyquistOptions object | nyquistoptions |
nicholsplot | NicholsOptions object | nicholsoptions |
stepplot | TimeOptions object | timeoptions |
impulseplot | TimeOptions object | timeoptions |
rlocusplot | PZOptions object | pzoptions |
pzplot | PZOptions object | pzoptions |
iopzplot | PZOptions object | pzoptions |
hsvplot | HSVOptions object | hsvoptions |
Version History
Introduced in R2022b
See Also
Functions
bodeplot
|stepplot
|rlocusplot
|impulseplot
|nicholsplot
|nyquistplot
|pzplot
|hsvplot
|iopzplot
|sigmaplot
|bodeoptions
|nicholsoptions
|hsvoptions
|nyquistoptions
|pzoptions
|sigmaoptions
|timeoptions
Live Editor Tasks
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)