Create Plot
Interactively visualize filter responses and other outputs for several signal processing functions
Since R2023a
Description
The Create Plot task lets you interactively visualize filter responses and other outputs for several signal processing functions in your MATLAB® workspace.
You can create a Create Plot task to visualize the outputs of these signal processing functions:
cwt(since R2026a)freqz(Signal Processing Toolbox)grpdelay(Signal Processing Toolbox)impz(Signal Processing Toolbox)periodogram(Signal Processing Toolbox)pspectrum(Signal Processing Toolbox)pwelch(Signal Processing Toolbox)spectrogram(Signal Processing Toolbox)zplane(Signal Processing Toolbox)
The functions covered in this task are available when you select
Signal Processing in the Filter by Category
menu in the Create Plot
Live Editor task. To learn more about Live Editor tasks, see Add Interactive Tasks to a Live Script.

Open the Task
To add the Create Plot task to a live script in the MATLAB Editor:
On the Live Editor tab, click Task > Create Plot.
In a code block in the live script, type a relevant keyword, such as
cwt,grpdelay,pspectrum, orspectrogram. 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
Use the Create Plot task in the Live Editor to interactively create and visualize the spectrogram of a vibrational signal.
Load the signal, vib, which measures vibration in a helicopter. The signal lasts for 10 seconds at a sample rate Fs of 500 Hz.
load helidataTo visualize the spectrogram using the pspectrum visualization:
Open the Create Plot task.
In the Filter by Category menu of the Select visualization section, select
Signal Processing. The gallery that appears shows several visualization functions that you can use to plot outputs related to signal processing.In the gallery, click the
pspectrumvisualization.Set the parameters for the visualization. Expand the Select data section.
Set Configuration to
Specify sample rate for spectrogram.Set Input signal to
vib.Set Sample rate to
fs.
To see the code that this task generates, expand the task display by clicking Show code at the bottom of the task parameter area.

Use the Create Plot task in the Live Editor to interactively create and visualize the scalogram using the continuous wavelet transform.
Load the electrocardiogram (ECG) signal into your workspace. The sample rate is 180 Hz.
load wecg
Fs = 180;To visualize the scalogram, open the Create Plot task. Start by typing the keyword cwt in a code block and then click Create Plot. Select the input signal and sample rate to plot the scalogram. By default, the cwt function uses the (3,60) analytic Morse wavelet
To see the code that this task generates, expand the task display by clicking
Show code at the bottom of the task parameter area.

Change Default Wavelet
To visualize the scalogram using the bump wavelet, open the Create Plot task. Start by typing the keyword cwt in a code block and then click Create Plot. Select the input signal and sample rate to plot the scalogram. Expand Select optional visualization parameters and select the bump wavelet.
To see the code that this task generates, expand the task display by clicking
Show code at the bottom of the task parameter area.

Specify Sample Time
Load the Kobe earthquake data. The sample time is 1 second.
load kobe
Ts = seconds(1);To visualize the scalogram using the sample time, open the Create Plot task. Start by typing the keyword cwt in a code block and then click Create Plot. Select the configuration Specify signal with sample time for scalogram. Select the input signal and sample time to plot the scalogram.
To see the code that this task generates, expand the task display by clicking
Show code at the bottom of the task parameter area.

Parameters
This table lists the parameters that you can set for the selected visualization.
| Visualization | Parameter Name | Parameter Value |
|---|---|---|
cwt | Input signal — Input signal | Vector of at least four elements |
Sample rate — Sample rate in Hz To
specify this parameter, set Configuration to
|
| |
Sample time — Sample time To
specify this parameter, set Configuration to
|
| |
freqz (Signal Processing Toolbox)grpdelay (Signal Processing Toolbox)impz (Signal Processing Toolbox) | Digital filter — Digital filter object To specify this parameter, set
Configuration to |
|
SOS — Filter representation as second-order section (SOS) matrix To specify this parameter, set
Configuration to | L-by-6 matrix L is the number of sections. | |
Numerator coefficients — Filter numerator coefficients To specify this parameter, set
Configuration to | Scalar | vector | L-by-m matrix L is the number of sections and m – 1 is the numerator order. | |
Denominator coefficients — Filter denominator coefficients To specify this parameter, set
Configuration to |
L is the number of sections and n – 1 is the denominator order. | |
Sample rate — Sample rate in Hz This parameter applies only for the | Positive scalar By default, the visualization uses normalized frequencies. | |
| Number of points — Number of points to use to evaluate response | Positive integer | |
periodogram (Signal Processing Toolbox)pwelch (Signal Processing Toolbox)spectrogram (Signal Processing Toolbox) | Input signal — Input signal | Vector | matrix For the
|
Window — Spectral window to segment input signal | Positive integer | vector For the
| |
Number of overlap samples — Number of overlap samples between adjoining segments This parameter does not
apply for the |
| |
Frequencies — Cyclical frequencies (in Hz) associated with PSD estimate or power spectrum To specify this
parameter, set Configuration to | Vector | |
Sample rate — Sample rate (in Hz) of input signal To specify this parameter, set
Configuration to | Positive scalar By default, the visualization uses normalized frequencies | |
Normalized frequencies — Normalized frequencies (in πrad/sample) associated with PSD estimate or power spectrum To specify this parameter, set
Configuration to | Vector | |
Number of DFT points — Number of points to compute discrete Fourier transform (DFT) To specify this
parameter, set Configuration to | Positive integer | |
pspectrum (Signal Processing Toolbox) | Input signal — Input signal | Vector | matrix The Create Plot task only supports a matrix input when you select a power spectrum configuration. |
Sample rate — Sample rate in Hz To
specify this parameter, set Configuration to
| Positive scalar By default, the visualization uses normalized frequencies. | |
Sample time — Sample time To
specify this parameter, set Configuration to
|
By default, the visualization uses normalized frequencies. | |
zplane (Signal Processing Toolbox) | Digital filter — Digital filter object To specify this parameter, set
Configuration to |
|
Numerator coefficients — Filter numerator coefficients To specify this parameter, set
Configuration to | L-by-m matrix L is the number of sections and m – 1 is the numerator order. | |
Denominator coefficients — Filter denominator coefficients To specify this parameter, set
Configuration to |
L is the number of sections and n – 1 is the denominator order. | |
Zeros — Zeros of filter transfer function To specify this parameter, set
Configuration to | Scalar | column vector | |
Poles — Poles of filter transfer function To specify this parameter, set
Configuration to | Scalar | column vector By default, the visualization assumes no poles. | |
Sample rate — Sample rate in Hz | Positive scalar By default, the visualization uses normalized frequencies. |
This table lists the optional parameters that you can set for the selected visualization.
| Visualization | Parameter Name | Parameter Value |
|---|---|---|
cwt | Wavelet — Name of analytic wavelet |
|
freqz (Signal Processing Toolbox)grpdelay (Signal Processing Toolbox) | Output type — Option to evaluate frequency response around entire unit circle |
By default, the visualization evaluates the response around the upper half of the unit circle. |
periodogram (Signal Processing Toolbox)pwelch (Signal Processing Toolbox)spectrogram (Signal Processing Toolbox) | Spectrum type — Power spectrum scaling |
|
Trace — Mode to trace Welch's estimate in each frequency bin This parameter applies only for the
|
| |
Frequency location — Axis on which to locate frequencies This parameter applies only for the
|
|
Version History
Introduced in R2023aYou can now use the Create Plot Live Editor task to
interactively visualize the output of the cwt function. You can select different chart types and set optional
parameters. The task also automatically generates code that becomes part of your live
script.
See Also
Functions
cwt|freqz(Signal Processing Toolbox) |grpdelay(Signal Processing Toolbox) |impz(Signal Processing Toolbox) |periodogram(Signal Processing Toolbox) |pspectrum(Signal Processing Toolbox) |pwelch(Signal Processing Toolbox) |spectrogram(Signal Processing Toolbox) |zplane(Signal Processing Toolbox)
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)



