Main Content

Configure Array Plot MATLAB Object

When you use the dsp.ArrayPlot object in MATLAB®, 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.

  • Min X-Axis — Array Plot sets the minimum x-axis limit using the value of the XOffset 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 summing the value of the X-offset parameter with the span of x-axis values. The relationship between the span of the x-axis data and the Sample Increment property is determined by this equation:


    To modify the SampleIncrement from the Array Plot window, click Settings and set the Sample Increment. If you set SampleIncrement to 0.1 and the input signal data has 51 samples, the scope displays values on the x-axis from 0 to 5. If you also set the X-offset to –2.5, the scope displays values on the x-axis from –2.5 to 2.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 — Occurs after you run the step method and before you run the release method.

    • Stopped — Occurs after you construct the scope object and before you first call the object. This status also occurs after you call release.

  • Title, X-Axis Label, Y-Axis Label — You can customize the title and axes labels from Settings or by using the Title, YLabel, and XLabel properties.

  • Toolstrip — The Plot 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.

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, a 2-channel signal would have the following default names in the channel legend: Channel 1, Channel 2. To show the legend, on the Plot tab, click Legend. If there are a total of seven input channels, the legend appears in the display as:

By default, the scope has a black axes background and chooses line colors for each channel in a manner similar to the Simulink® 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 above figure. 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 the following order:

To choose line colors or background colors, on the Plot 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 Plot Settings

On the Plot 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.

  • The Magnitude Phase button splits the magnitude and phase of the input signal and plots them on two separate axes within the same window. This button corresponds to the PlotAsMagnitudePhase property in the object.

  • The Settings button opens the settings window which allows you to customize the x-axis, y-limits, plot labels, and signal colors.

Use dsp.ArrayPlot 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 various 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 all the values within the displayed portion of the input signal.

  • Median — Median value within the displayed portion of the input signal.

  • RMS — Root mean squared of the input signal.

To customize which statistics are shown and computed, use the Signal Statistics drop-down.

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 the findpeaks function reference.

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 minimum height difference between a peak and its neighboring samples.

  • Min Distance — The minimum number of samples between adjacent peaks.

  • Threshold — The level above which peaks are detected.

  • 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 Plot tab.

  • 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.

  • Print — Opens a print dialog box from which you can print out the plot image.

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, hiding all labels and insetting the axes values.

  • — Zoom in to the plot.

  • — Pan around the axes.

  • — Autoscale the axes to fit the shown data.

See Also

Related Topics