Configure Array Plot
When you use the dsp.ArrayPlot
object in MATLAB® or the Array Plot block in Simulink® you can configure many settings and tools from the interface. These
sections show you how to use the Array Plot interface and the tools available.
Signal Display
This figure highlights the important aspects of the Array Plot window, in MATLAB:
And in Simulink:
Min X-Axis — Array Plot sets the minimum x-axis limit using the value of the X-Offset property. To change the X-Offset from the Array Plot window, click Settings and set the X-Offset.
Max X-Axis — Array Plot sets the maximum x-axis limit by adding the value of X-Offset parameter with the span of x-axis values multiplied by the Sample Increment property as determined by this equation:
To modify the Sample Increment from the Array Plot window, click Settings and set the Sample Increment. If you set Sample Increment to
0.1
and the input signal data has 51 samples, the scope displays values on the x-axis from0
to5
. If you also set the X-Offset to–2.5
, the scope displays values on the x-axis from–2.5
to2.5
. The values on the x-axis of the scope display remain the same throughout simulation.Status — Provides the current status of the plot. The status can be:
Processing
Object — Occurs after you run the object and before you run the
release
method.Block — Occurs during the simulation.
Stopped
Object — Occurs after you call
release
.Block — Occurs before and after the simulation.
Ready
Object — Occurs after you construct the scope object and before you first call the object.
Block — Occurs after you open the scope and before your first run a simulation.
Paused
Block — Occurs when you pause the simulation.
Title, X-Label, Y-Label — You can customize the title and axes labels from Settings or by using the
Title
,YLabel
, andXLabel
properties.Toolstrip — The Scope tab contains buttons and settings to customize and share the array plot. The Measurements tab contains buttons and settings to turn on different measurement tools. Use the pin button to keep the toolstrip showing or the arrow button to hide the toolstrip.
(Block only) Simulation Controls — Control your Simulink simulation from the Array Plot window.
Multiple Signal Names and Colors
By default, if the input signal has multiple channels, the scope uses an index
number to identify each channel of that signal. For example, the legend for a
two-channel signal will display the default names Channel 1
,
Channel 2
. To show the legend, on the
Scope tab, click Legend. If there are
a total of seven input channels, the legend displayed is:
By default, the scope has a black axes background and chooses line colors for each channel in a manner similar to the Scope (Simulink) block. When the scope axes background is black, it assigns each channel of each input signal a line color in the order shown in the legend. If there are more than seven channels, then the scope repeats this order to assign line colors to the remaining channels. When the axes background is not black, the signals are colored in this order:
To choose line colors or background colors, on the Scope tab, click Settings. Use the Axes color drop-down to change the background of the plot. Click Line to choose a line to change, and the Color drop-down to change the line color of the selected line.
Configure Scope Settings
On the Scope tab, the Configuration section allows you to modify the plot.
The Legend button turns the legend on or off. When you show the legend, you can control which signals are shown. If you click a signal name in the legend, the signal is hidden from the plot and shown in grey on the legend. To redisplay the signal, click on the signal name again. This button corresponds to the
ShowLegend
property in the object or the Show Legend property on the block.The Settings button opens the settings window which allows you to customize the x-axis, y-axis limits, plot labels, and signal colors.
Use Array Plot Measurements
All measurements are made for a specified channel. By default, measurements are applied to the first channel. To change which channel is being measured, use the Select Channel drop-down in the Measurements tab.
Data Cursors
Use the Data Cursors button to display screen cursors. The cursors are vertical cursors that track along the selected signal. Between the two cursors, the difference between the x- and y-values of the signal at the two cursor points is displayed.
Signal Statistics
Use the Signal Statistics button to display statistics about the selected signal at the bottom of the array plot window. You can hide or show the Statistics panel using the arrow button in the bottom right of the panel.
Max — Maximum value within the displayed portion of the input signal.
Min — Minimum value within the displayed portion of the input signal.
Peak to Peak — Difference between the maximum and minimum values within the displayed portion of the input signal.
Mean — Average or mean of the values within the displayed portion of the input signal.
Variance –– Variance of the values within the displayed portion of the input signal.
Standard Deviation –– Standard deviation of the values within the displayed portion of the input signal.
Median — Median value within the displayed portion of the input signal.
RMS — Root mean square of the input signal.
Mean Square –– Mean square of the values within the displayed portion of the input signal.
To customize which statistics to show and compute, use the Signal Statistics list.
Peak Finder
Use the Peak Finder button to display peak
values for the selected signal. Peaks are defined as a local maximum where lower
values are present on both sides of a peak. Endpoints are not considered peaks.
For more information on the algorithms used, see findpeaks
.
When you turn on the peak finder measurements, an arrow appears on the plot at each maxima and a Peaks panel appears at the bottom of the array plot window showing the x and y values at each peak.
You can customize several peak finder settings:
Num Peaks — The number of peaks to show. Must be a scalar integer from 1 through 99.
Min Height — The level above which peaks are detected.
Min Distance — The minimum number of samples between adjacent peaks.
Threshold — The minimum height difference between a peak and its neighboring samples.
Label Peaks — Show labels (P1, P2, …) above the arrows on the plot.
Share or Save the Array Plot
If you want to save the array plot for future use or share it with others, use the buttons in the Share section of the Scope tab.
(Object only) Generate Script — Generate a script to regenerate your array plot with the same settings. An editor window opens with the code required to recreate your
dsp.ArrayPlot
.
Copy Display — Copy the display to your clipboard. You can paste the image in another program to save or share.
Preserve Colors –– Preserve colors while copying to the clipboard.
Print — Opens a print dialog box from which you can print out the plot image.
Snapshot — During a simulation, use the Snapshot button to pause the visualization at an interesting point so you can take a screenshot of the Array Plot window.
Scale Axes
To scale the plot axes, you can use the mouse to pan around the axes and the scroll button on your mouse to zoom in and out of the plot. Additionally, you can use the buttons that appear when you hover over the plot window.
— Maximize the axes, hide all labels and inset the axes values.
— Zoom in and out of the plot.
— Pan the plot.
— Autoscale the axes to fit the shown data.
Set Additional Properties
You can only change some Array Plot properties outside the Array
Plot window, such as the signal names in the legend or the number of inputs. For the
dsp.ArrayPlot
object, you can set those properties from the
command-line. For the Array Plot block, set those properties using
the Property Inspector (Set Block Parameter Values (Simulink)) or from the command-line using get_param
(Simulink) and set_param
(Simulink).
Find the Array Plot Block in Your Model
To highlight the Array Plot block within your model, on the Scope tab, select the Highlight Block button. On the Simulink canvas, the Array Plot block is outlined in a highlight color so you can more easily identify it in your model.