Configure Array Plot - MATLAB & Simulink (original) (raw)
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 theX-Offset property. To change theX-Offset from the Array Plot window, clickSettings and set theX-Offset.
- Max X-Axis — Array Plot sets the maximum x-axis limit by adding the value ofX-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 theSample Increment. If you set Sample Increment to0.1
and the input signal data has 51 samples, the scope displays values on the_x_-axis from0
to5
. If you also set theX-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 therelease
method.
* Block — Occurs during the simulation.Stopped
* Object — Occurs after you callrelease
.
* 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 fromSettings or by using the
Title
,YLabel
, andXLabel
properties. - Toolstrip — TheScope tab contains buttons and settings to customize and share the array plot. TheMeasurements 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 theScope 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 theShow 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 theSelect Channel drop-down in theMeasurements 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 theSignal 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 to Clipboard — 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 thedsp.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 theScope 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.