Configure Time Scope MATLAB Object

When you use the timescope object in MATLAB®, you can configure many settings and tools from the window. These sections show you how to use the Time Scope interface and the available tools.

Signal Display

This figure highlights the important aspects of the Time Scope window in MATLAB.

  • Min X-Axis — Time scope sets the minimum x-axis limit using the value of the TimeDisplayOffset property. To change the Time Offset from the Time Scope window, click Settings () on the Scope tab. Under Data and Axes, set the Time Offset.

  • Max X-Axis — Time scope sets the maximum x-axis limit by summing the value of the Time Offset property with the span of the x-axis values. If Time Span is set to Auto, the span of x-axis is 10/SampleRate.

    The values on the x-axis of the scope display remain the same throughout the simulation.

  • Status — Provides the current status of the plot. The status can be:

    • Processing — Occurs after you run the step function and before you run the release function.

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

  • Title, YLabel — You can customize the title and the y-axis label from Settings or by using the Title and YLabel properties.

  • Toolstrip — The Scope tab contains buttons and settings to customize and share the time scope. 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, 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 Settings (). Under Display and Labels, select Show 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 Simulink® Scope 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 pallet 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 scope.

  • 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 Settings button opens the settings window which allows you to customize the data, axes, display settings, labels, and color settings.

On the Scope tab, the Layout section allows you to modify the scope layout dimensions.

The Display Grid button enables you to select the display layout of the scope.

Use timescope 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 on the Measurements tab.

Data Cursors

Use the Data Cursors button to display screen cursors. Each cursor tracks a vertical line along the signal. The difference between x- and y-values of the signal at the two cursors is displayed in the box between the cursors.

Signal Statistics

Use the Signal Statistics button to display various statistics about the selected signal at the bottom of the time scope window. You can hide or show the Statistics panel using the arrow button 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. End points are not considered peaks. For more information on the algorithms used, see the findpeaks function.

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 timescope 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 Time Scope

If you want to save the time scope for future use or share it with others, use the buttons in the Share section of the Scope tab.

  • Generate Script — Generate a script to re-create your time scope with the same settings. An editor window opens with the code required to re-create your timescope object.

  • Copy Display — Copy the display to your clipboard. You can paste the image in another program to save or share it.

  • 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 on the plot.

  • — Pan the plot.

  • — Autoscale the axes to fit the shown data.

See Also