Documentation

dsp.TimeScope System object

Package: dsp

Time domain signal display

Description

The TimeScope object displays time-domain signals.

To display time-domain signals in the Time Scope:

  1. Define and set up your Time Scope. See Construction.

  2. Call step to display the signal in the Time Scope figure. The behavior of step is specific to each object in the toolbox.

Use the MATLAB® clear function to close the Time Scope figure window.

See the following sections for information on the Time Scope System object™:

See the following sections for information on the Time Scope Graphical User Interface:

For examples on how to use the Time Scope System object, see Examples.

    Note:   For information about the Time Scope block, see Time Scope.

    Note:   If you own the MATLAB Coder™ product, you can generate C or C++ code from MATLAB code in which an instance of this system object is created. When you do so, the scope system object is automatically declared as an extrinsic variable. In this manner, you are able to see the scope display in the same way that you would see a figure using the plot function, without directly generating code from it. For the full list of system objects supporting code generation, see DSP System Toolbox in the MATLAB Coder documentation.

Construction

H = dsp.TimeScope returns a Time Scope System object, H. This object displays real- and complex-valued floating and fixed-point signals in the time domain.

H = dsp.TimeScope('PropertyName',PropertyValue,...) creates a Time Scope System object, H, with each specified property PropertyName set to the specified value.

H = dsp.TimeScope(NUMINPUTS,SAMPLERATE,'PropertyName',PropertyValue,...) creates a Time Scope System object, H. This object has the NumInputPorts property set to NUMINPUTS, the SampleRate property set to SAMPLERATE, and other specified properties set to the specified values. NUMINPUTS and SAMPLERATE are value-only arguments. You can specify PropertyNamePropertyValue arguments in any order.

Properties

ActiveDisplay

Active display for display-specific properties

Specify the active display as an integer to get and set relevant properties. The number of a display corresponds to its column-wise placement index. Set this property to control which display has its axes colors, line properties, marker properties, and visibility changed. Tunable

Setting this property controls which display is used for ShowGrid, ShowLegend, Title, PlotAsMagnitudePhase, YLabel, and YLimits.

Default: 1

BufferLength

Number of data points in buffer

Specify the size of the buffer that the scope holds in its memory cache. Memory is limited by available memory on your system. If your signal has M rows of data and N data points in each row, M x N is the number of data points per time step. Multiply this result by the number of time steps for your model to obtain the required buffer length. For example, if you have 10 rows of data with each row having 100 data points and your run will be 10 time steps, you should enter 10,000 (which is 10 x 100 x 10) as the buffer length.

Default: 5000

FrameBasedProcessing

Process input in frames or as samples

When you set this property to true, you enable frame-based processing. When you set this property to false, you enable sample-based processing.

Default: true

LayoutDimensions

Layout grid dimensions

Specify the layout grid dimensions as a 2-element vector: [numberOfRows, numberOfColumns]. You can use no more than four rows or four columns. This property is Tunable.

Default: [1,1]

MaximizeAxes

Maximize axes control

Specify whether to display the scope in maximized axes mode. In this mode, each of the axes is expanded to fit into the entire display. To conserve space, labels do not appear in each display. Instead, tick-mark values appear on top of the plotted data. You can select one of the following options:

  • Auto — In this mode, the axes appear maximized in all displays only if the Title and YLabel properties are empty for every display. If you enter any value in any display for either of these properties, the axes are not maximized.

  • On — In this mode, the axes appear maximized in all displays. Any values entered into the Title and YLabel properties are hidden.

  • Off — In this mode, none of the axes appear maximized.

This property is Tunable.

Default: 'Auto'

Name

Caption to display on the Time Scope window

Specify as a string the caption to display on the scope window. This property is Tunable.

Default: 'Time Scope'

NumInputPorts

Number of input signals

Specify the number of input signals to display on the scope as a positive integer. You must invoke the step method with the same number of inputs as the value of this property.

Default: 1

PlotAsMagnitudePhase

Plot signal magnitude and phase

When you set this property to true, the scope plots the magnitude and phase of the input signal on two separate axes within the same active display. When you set this property to false, the scope plots the real and imaginary parts of the input signal on two separate axes within the same active display. This property is particularly useful for complex-valued input signals. Selecting this check box affects the phase for real-valued input signals. When the amplitude of the input signal is nonnegative, the phase is 0 degrees. When the amplitude of the input signal is negative, the phase is 180 degrees. This property is Tunable.

When set, ActiveDisplay controls which displays are updated. The active display shows the magnitude of the input signal on the top axes and its phase, in degrees, on the bottom axes.

Default: false

PlotType

Option to control the type of plot

Specify the type of plot to use for all the input signals displayed in the scope window.

  • When you set this property to 'Line' , the scope displays the input signal as lines connecting each of the sampled values. This approach is similar to the functionality of the MATLAB line or plot function.

  • When you set this property to 'Stairs', the scope displays the input signal as a stairstep graph. A stairstep graph is made up of only horizontal lines and vertical lines. Each horizontal line represents the signal value for a discrete sample period and is connected to two vertical lines. Each vertical line represents a change in values occurring at a sample. This approach is equivalent to the MATLAB stairs function. Stairstep graphs are useful for drawing time history graphs of digitally sampled data.

This property is Tunable.

Default: 'Line'

Position

Time Scope window position in pixels

Specify, in pixels, the size and location of the scope window as a 4-element double vector of the form, [left bottom width height]. You can place the scope window in a specific position on your screen by modifying the values to this property. This property is Tunable.

Default: The default depends on your screen resolution. By default, the Time Scope window appears in the center of your screen with a width of 410 pixels and height of 300 pixels.

ReduceUpdates

Reduce updates to improve performance

When you set this property to true, the scope logs data for later use and updates the window periodically. When you set this property to false, the scope updates every time the step method is called. The simulation speed is faster when this property is set to true. This property is Tunable.

You can also modify this property from the Time Scope GUI. Opening the Simulation menu and clearing the Reduce Updates to Improve Performance check box is the same as setting this property to false.

Default: true

SampleRate

Sample rate of inputs

Specify the sample rate, in hertz, of the input signals.

You can specify a scalar or as a numeric vector with length equal to the value of NumInputPorts. The inverse of the sample rate determines the spacing between points on the time-axis in the displayed signal. When you set SampleRate to a scalar value and NumInputPorts is greater than 1, the object uses the same sample rate for all inputs.

Default: 1

ShowGrid

Option to enable or disable grid display

When you set this property to true, the grid appears. When you set this property to false, the grid is hidden. This property is Tunable.

When set, ActiveDisplay controls which display is updated.

Default: false

ShowLegend

When you set this property to true, the scope displays a legend with the input channels string labels specified in the ChannelNames property. When you set this property to false, the scope does not display a legend. This property applies only when you set the SpectrumType property to 'Power' or 'Power density'. This property is Tunable.

See FrameBasedProcessing for information on input channels.

When set, ActiveDisplay controls which display is updated.

Default: false

TimeAxisLabels

Time-axis labels

Specify how time-axis labels should appear in the scope displays as one of 'All', 'Bottom, or 'None'.

  • When you set this property to 'All', time-axis labels appear in all displays.

  • When you set this property to 'Bottom', time-axis labels appear in the bottom display of each column.

  • When you set this property to 'None', there are no labels in any displays.

This property is Tunable.

Default: 'All'

TimeDisplayOffset

Time display offset

Specify the offset, in seconds, to apply to the time-axis. This property can be either a numeric scalar or a vector of length equal to the number of input channels. If you specify this property as a scalar, then that value is the time display offset for all channels. If you specify a vector, each vector element is the time offset for the corresponding channel. For vectors with length less than the number of input channels, the time display offsets for the remaining channels are set to 0. If a vector has a length greater than the number of input channels, the extra vector elements are ignored. This property is Tunable.

See FrameBasedProcessing for information on input channels. See TimeSpan and TimeSpanSource for information on the x-axis limits and time span settings.

Default: 0

TimeSpan

Time span

Specify the time span, in seconds, as a positive, numeric scalar value. This property applies when FrameBasedProcessing is false. This property also applies when FrameBasedProcessing is true and TimeSpanSource is Property. The time-axis limits are calculated as follows.

  • Minimum time-axis limit = min(TimeDisplayOffset)

  • Maximum time-axis limit = max(TimeDisplayOffset) + TimeSpan

where TimeDisplayOffset and TimeSpan are the values of their respective properties. This property is Tunable.

Default: 10

TimeSpanOverrunAction

Wrap or scroll when the TimeSpan value is overrun

Specify how the scope displays new data beyond the visible time span. You can select one of the following options:

  • Wrap — In this mode, the scope displays new data until the data reaches the maximum time-axis limit. When the data reaches the maximum time-axis limit of the scope window, the scope clears the display. The scope then updates the time offset value and begins displaying subsequent data points starting from the minimum time-axis limit.

  • Scroll — In this mode, the scope scrolls old data to the left to make room for new data on the right side of the scope display. This mode is graphically intensive and can affect run-time performance. However, it is beneficial for debugging and monitoring time-varying signals.

This property is Tunable.

Default: 'Wrap'

TimeSpanSource

Source of time span

Specify the source of the time span for frame-based input signals as one of 'Auto' or 'Property'. This property applies when FrameBasedProcessing is set to true. When you set this property to 'Property', the object derives the x-axis limits from the TimeDisplayOffset and TimeSpan properties. When you set this property to Auto, the time-axis limits are the following:

  • Minimum time-axis limit = min(TimeDisplayOffset)

  • Maximum time-axis limit = max(TimeDisplayOffset) + max(1/SampleRate.*FrameSize)

where TimeDisplayOffset and SampleRate are the values of their respective properties. FrameSize is a vector equal to the number of rows in each input signal. This property is Tunable.

Default: 'Property'

TimeUnits

Units of the time-axis

Specify the units used to describe the time-axis. You can select one of the following options:

  • Metric — In this mode, the scope converts the times on the time-axis to the most appropriate measurement units. These units include milliseconds, microseconds, nanoseconds, minutes, days, etc. The scope chooses the appropriate measurement units based on the minimum time-axis limit and the maximum time-axis limit of the scope window.

  • Seconds — In this mode, the scope always displays the units on the time-axis as seconds.

  • None — In this mode, the scope does not display any units on the time-axis. The scope only shows the word Time on the time-axis.

This property is Tunable.

Default: 'Metric'

Title

Display title

Specify the display title as a string. Enter %<SignalLabel> to use the signal labels in the Simulink Model as the axes titles. This property is Tunable.

When set, ActiveDisplay controls which display is updated.

Default: ''

YLabel

The label for the y-axis

Specify as a string the text for the scope to display to the left of the y-axis. Tunable

This property applies only when PlotAsMagnitudePhase is false. When PlotAsMagnitudePhase is true, the two y-axis labels are read-only values. The y-axis labels are set to 'Magnitude' and 'Phase' for the magnitude plot and the phase plot, respectively. When set, ActiveDisplay controls which display is updated.

Default: 'Amplitude' if PlotAsMagnitudePhase is false

YLimits

The limits for the y-axis

Specify the y-axis limits as a 2-element numeric vector, [ymin ymax]. This property is Tunable.

When PlotAsMagnitudePhase is true, this property specifies the y-axis limits of only the magnitude plot. The y-axis limits of the phase plot are always [-180, 180]. When set, ActiveDisplay controls which display is updated.

Default: [-10, 10], if PlotAsMagnitudePhase is false, or [0, 10], if PlotAsMagnitudePhase is true.

Methods

cloneCreate time scope object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
hideHide time scope window
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of time scope object
showMake time scope window visible
stepDisplay signal in time scope figure

Displaying Multiple Signals

Multiple Signal Input

You can configure the Time Scope to show multiple signals within the same display or on separate displays. By default, the signals appear as different-colored lines on the same display. The signals can have different dimensions, sample rates, and data types. Each signal can be either real or complex valued. You can set the number of input ports on the Time Scope in the following ways:

  • Set the NumInputPorts property. This property is nontunable, so you should set it before you run the step method.

  • Run the show method to open the scope window. In the scope menu, select File > Number of Input Ports.

  • Run the show method to open the scope window. In the scope menu, select View > Configuration Properties and set the Number of input ports on the Main tab.

An input signal may contain multiple channels, depending on its dimensions. Multiple channels of data always appear as different-colored lines on the same display.

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, select View > Configuration Properties, click the Display tab, and select the Show Legend check box. If there are a total of 7 input channels, the following legend appears in the display.

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 above figure.

If there are more than 7 channels, then the scope repeats this order to assign line colors to the remaining channels. To choose line colors for each channel, change the axes background color to any color except black. To change the axes background color to white, select View > Style, click the Axes background color button ( ), and select white from the color palette. Run the simulation again. The following legend appears in the display. This is the color order when the background is not black.

Multiple Displays

You can display multiple channels of data on different displays in the scope window. In the scope toolbar, select View > Layout, or select the Layout button ( ).

    Note:   The Layout menu item and button are not available when the scope is in snapshot mode.

This feature allows you to tile the window into a number of separate displays, up to a grid of 4 rows and 4 columns. For example, if there are three inputs to the scope, you can display the signals in separate displays by selecting row 3, column 1, as shown in the following figure.

After you select row 3, column 1, the scope window is partitioned into three separate displays, as shown in the following figure.

When you use the Layout option to tile the window into multiple displays, the display highlighted in blue is referred to as the active display. The scope dialog boxes reference the active display.

Signal Display

Time Scope uses the Time span and Time display offset parameters in order to determine the time range. To change the signal display settings, select View > Configuration Properties to bring up the Visuals—Time Domain Properties dialog box. Then, modify the values for the Time span and Time display offset parameters on the Main tab. For example, if you set the Time span to 25 seconds, the scope displays 25 seconds' worth of simulation data at a time. If you also set the Time display offset to 5 seconds, the scope displays values on the time axis from 5 to 30 seconds. The values on the time-axis of the Time Scope display remain the same throughout simulation.

To communicate the simulation time that corresponds to the current display, the scope uses the Time units, Time offset, and Simulation time indicators on the scope window. The following figure highlights these and other important aspects of the Time Scope window.

Time Indicators

  • Minimum time-axis limit — The Time Scope sets the minimum time-axis limit using the value of the Time display offset parameter on the Main tab of the Visuals—Time Domain Properties dialog box. If you specify a vector of values for the Time display offset parameter, the scope uses the smallest of those values to set the minimum time-axis limit.

  • Maximum time-axis limit — The Time Scope sets the maximum time-axis limit by summing the value of Time display offset parameter with the value of the Time span parameter. If you specify a vector of values for the Time display offset parameter, the scope sets the maximum time-axis limit by summing the largest of those values with the value of the Time span parameter.

  • Time units — The units used to describe the time-axis. The Time Scope sets the time units using the value of the Time Units parameter on the Time tab of the Configuration Properties dialog box. By default, this parameter is set to Metric (based on Time Span) and displays in metric units such as milliseconds, microseconds, minutes, days, etc. You can change it to Seconds to always display the time-axis values in units of seconds. You can change it to None to not display any units on the time-axis. When you set this parameter to None, then Time Scope shows only the word Time on the time-axis.

    To hide both the word Time and the values on the time-axis, set the Show time-axis labels parameter to None. To hide both the word Time and the values on the time-axis in all displays except the bottom ones in each column of displays, set this parameter to Bottom Displays Only. This behavior differs from the Simulink Scope block, which always shows the values but never shows a label on the x-axis.

For more information, see Visuals — Time Domain Properties.

Simulation Indicators

  • Simulation status — Provides the current status of the model simulation. The status can be either of the following conditions:

    • 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 run the step method. This status also occurs after you run the release method.

    The Simulation status is part of the Status Bar in the scope window. You can choose to hide or display the entire Status Bar. From the scope menu, select View > Status Bar.

  • Time offset — The Time offset value helps you determine the simulation times for which the scope is displaying data. The value is always in the range 0Time offsetSimulation time. Therefore, add the Time offset to the fixed time span values on the time-axis to get the overall simulation time.

    For example, if you set the Time span to 20 seconds, and you see a Time offset of 0 (secs) on the scope window. This value indicates that the scope is displaying data for the first 0 to 20 seconds of simulation time. If the Time offset changes to 20 (secs), the scope displays data for simulation times from 20 seconds to 40 seconds. The scope continues to update the Time offset value until the simulation is complete.

  • Simulation time — The amount of time that the Time Scope has spent processing the input. Every time you call the step method, the simulation time increases by the number of rows in the input signal divided by the sample rate, as given by the following formula: . You can set the sample rate using the SampleRate property. For frame-based inputs, the displayed Simulation time is the time at the beginning of the frame.

    The Simulation time is part of the Status Bar in the Time Scope window. You can choose to hide or display the entire Status Bar. From the Time Scope menu, select View > Status Bar .

Axes Maximization

When the scope is in maximized axes mode, the following figure highlights the important indicators on the scope window.

To toggle this mode, in the scope menu, select View > Configuration Properties. In the Main pane, locate the Maximize axes parameter.

Specify whether to display the scope in maximized axes mode. In this mode, each of the axes is expanded to fit into the entire display. To conserve space, labels do not appear in each display. Instead, tick-mark values appear on top of the plotted data. You can select one of the following options:

  • Auto — In this mode, the axes appear maximized in all displays only if the Title and YLabel properties are empty for every display. If you enter any value in any display for either of these properties, the axes are not maximized.

  • On — In this mode, the axes appear maximized in all displays. Any values entered into the Title and YLabel properties are hidden.

  • Off — In this mode, none of the axes appear maximized.

This property is Tunable.

The default setting is Auto.

Reduce Updates to Improve Performance

By default, the scope updates the displays periodically at a rate not exceeding 20 hertz. If you would like the scope to update on every simulation time step, you can disable the Reduce Updates to Improve Performance option. However, as a recommended practice, leave this option enabled because doing so can significantly improve the speed of the simulation.

In the Time Scope menu, select Playback > Reduce Updates to Improve Performance to clear the check box. Alternatively, use the Ctrl+R shortcut to toggle this setting. You can also set the ReduceUpdates property to false to disable this option.

Toolbar

The Time Scope toolbar contains the following buttons.

Print Button

ButtonMenu LocationShortcut KeysDescription

File >
Print
Ctrl+P

Print the current scope window. Printing is available only when the scope display is not changing.

To print the current scope window to a figure rather than sending it to your printer, select File > Print to figure.

Zoom and Axes Control Buttons

ButtonMenu LocationShortcut KeysDescription

Tools >
Zoom In

N/A

When this tool is active, you can zoom in on the scope window. To do so, click in the center of your area of interest, or click and drag your cursor to draw a rectangular area of interest inside the scope window.

Tools >
Zoom X

N/A

You access the Zoom X button from the menu under the Zoom In icon. When this tool is active, you can zoom in on the x-axis. To do so, click inside the scope window, or click and drag your cursor along the x-axis over your area of interest.

Tools >
Zoom Y

N/A

You access the Zoom Y button from the menu under the Zoom In icon. When this tool is active, you can zoom in on the y-axis. To do so, click inside the scope window, or click and drag your cursor along the y-axis over your area of interest.

Tools >
Pan

N/A

You access the Pan button from the menu under the Zoom In icon. When this tool is active, you can pan on the scope window. To do so, click in the center of your area of interest and drag your cursor to the left, right, up, or down, to move the position of the display.

Tools >
Scale Y-Axis Limits
Ctrl+A

Click this button to scale the axes in the active scope window.

Alternatively, you can enable automatic axes scaling by selecting one of the following options from the Tools menu:

  • Automatically Scale Axes Limits — When you select this option, the scope scales the axes as needed during simulation.

  • Scale Axes Limits after 10 Updates — When you select this option, the scope scales the axes after 10 updates. The scope does not scale the axes again during the simulation.

  • Scale Axes Limits at Stop — When you select this option, the scope scales the axes each time the simulation is stopped.

Tools >
Scale X-Axis Limits
N/A

You access the Scale X-Axis Limits button from the menu under the current Axis Limits icon. Click this button to scale the axes in the X direction in the active scope window.

Alternatively, you can enable automatic axes scaling by selecting one of the following options from the Tools menu:

  • Automatically Scale Axes Limits — When you select this option, the scope scales the axes as needed during simulation.

  • Scale Axes Limits after 10 Updates — When you select this option, the scope scales the axes after 10 updates. The scope does not scale the axes again during the simulation.

  • Scale Axes Limits at Stop — When you select this option, the scope scales the axes each time the simulation is stopped.

Tools >
Scale X & Y Axes Limits
N/A

You access the Scale X & Y Axes Limits button from the menu under the current Axis Limits icon. Click this button to scale the axes in both the X and Y directions in the active scope window.

Alternatively, you can enable automatic axes scaling by selecting one of the following options from the Tools menu:

  • Automatically Scale Axes Limits — When you select this option, the scope scales the axes as needed during simulation.

  • Scale Axes Limits after 10 Updates — When you select this option, the scope scales the axes after 10 updates. The scope does not scale the axes again during the simulation.

  • Scale Axes Limits at Stop — When you select this option, the scope scales the axes each time the simulation is stopped.

Measurements Buttons

Tools >
Triggers

N/A

Open or close the Triggers panel. This panel allows you to pause the display only when certain events occur. You can use the Triggers panel when you want to align or search for interesting events. Triggers can be configured to both select and align specific regions of interest in the display area of the scope.

See the Triggers Panel section for more information.

Tools >
Measurements
>
Cursor Measurements

N/A

Open or close the Cursor Measurements panel. This panel puts screen cursors on all the displays.

See the Cursor Measurements Panel section for more information.

Tools >
Measurements
>
Signal Statistics

N/A

You access the Signal Statistics button from the menu under the current Measurements icon. Open or close the Signal Statistics panel. This panel displays the maximum, minimum, peak-to-peak difference, mean, median, RMS values of a selected signal, and the times at which the maximum and minimum occur.

See the Signal Statistics Panel section for more information.

Tools >
Measurements
>
Bilevel Measurements

N/A

You access the Bilevel Measurements button from the menu under the current Measurements icon. Open or close the Bilevel Measurements panel. This panel displays information about a selected signal's transitions, overshoots or undershoots, and cycles.

See the Bilevel Measurements Panel section for more information.

Tools >
Measurements
>
Peak Finder

N/A

You access the Peak Finder button from the menu under the current Measurements icon. Open or close the Peak Finder panel. This panel displays maxima and the times at which they occur, allowing the settings for peak threshold, maximum number of peaks, and peak excursion to be modified.

See the Peak Finder Panel section for more information.

Other Buttons

View > Layout

N/A

Arrange the layout of displays in the Time Scope. This feature allows you to tile your screen into a number of separate displays, up to a grid of 4 rows and 4 columns. You may find multiple displays useful when the Time Scope takes multiple input signals. The default display is 1 row and 1 column. See the Multiple Displays section for more information.

You can control whether this toolbar appears in the Time Scope window. From the Time Scope menu, select View > Toolbar.

Measurements Panels

The Measurements panels are the five panels that appear to the right side of the Time Scope GUI. These panels are labeled Trace selection, Cursor measurements, Signal statistics, Bilevel measurements, and Peak finder.

Measurements Panel Buttons

Each of the Measurements panels contains the following buttons that enable you to modify the appearance of the current panel.

ButtonDescription

Move the current panel to the top. When you are displaying more than one panel, this action moves the current panel above all the other panels.

Collapse the current panel. When you first enable a panel, by default, it displays one or more of its panes. Click this button to hide all of its panes to conserve space. After you click this button, it becomes the expand button .

Expand the current panel. This button appears after you click the collapse button to hide the panes in the current panel. Click this button to display the panes in the current panel and show measurements again. After you click this button, it becomes the collapse button again.

Undock the current panel. This button lets you move the current panel into a separate window that can be relocated anywhere on your screen. After you click this button, it becomes the dock button in the new window.

Dock the current panel. This button appears only after you click the undock button. Click this button to put the current panel back into the right side of the Scope window. After you click this button, it becomes the undock button again.

Close the current panel. This button lets you remove the current panel from the right side of the Scope window.

Some panels have their measurements separated by category into a number of panes. Click the pane expand button to show each pane that is hidden in the current panel. Click the pane collapse button to hide each pane that is shown in the current panel.

Trace Selection Panel

When you use the scope to view multiple signals, the Trace Selection panel appears if you have more than one signal displayed and you click any of the other Measurements panels. The Measurements panels display information about only the signal chosen in this panel. Choose the signal name for which you would like to display time domain measurements. See the following figure.

You can choose to hide or display the Trace Selection panel. In the Scope menu, select Tools > Measurements > Trace Selection.

Triggers Panel

The Triggers panel allows you to pause the display only when certain events occur. You can use the Triggers panel when you want to align or search for interesting events. You can configure triggers to both select and align specific regions of interest in the display area of the scope. Triggers work across multiple displays. You can also choose to hide or display the Triggers panel. In the scope toolbar, click the Triggers button ( ). Alternatively, in the scope menu, select Tools > Triggers.

When the Triggers panel is displayed, triangle pointers appear at the top and right side of the axes on each display. These markers indicate the time position ( ) and level ( ) at the event. The color of the markers corresponds to the color of the source signal.

    Note:   The scope does not display an event until at least a full-time span is completely viewable inside the display. To prevent data from being shown twice in the display, the scope suppresses the alignment of recurring events until a full-time span has elapsed since the previous update.

 Main Pane

 Source / Type Pane

 Levels / Timing Pane

 Delay / Holdoff Pane

Cursor Measurements Panel

The Cursor Measurements panel displays screen cursors. In the Scope menu, select Tools > Measurements > Cursor Measurements. Alternatively, in the Scope toolbar, click the Cursor Measurements button.

You can use the mouse or the left and right arrow keys to move vertical or waveform cursors and the up and down arrow keys for horizontal cursors.

The Measurements pane shows the time and value measurements.

  • 1 |— Shows or enables you to modify the time or value at cursor number one, or both.

  • 2 :— Shows or enables you to modify the time or value at cursor number two, or both.

  • Δt— Shows the absolute value of the difference in the times between cursor number one and cursor number two.

  • ΔV— Shows the absolute value of the difference in signal amplitudes between cursor number one and cursor number two.

  • 1/Δt— Shows the rate, the reciprocal of the absolute value of the difference in the times between cursor number one and cursor number two.

  • ΔV/Δt— Shows the scope, the ratio of the absolute value of the difference in signal amplitudes between cursors to the absolute value of the difference in the times between cursors.

Signal Statistics Panel

The Signal Statistics panel displays the maximum, minimum, peak-to-peak difference, mean, median, and RMS values of a selected signal. It also shows the x-axis indices at which the maximum and minimum values occur. In the Scope menu, select Tools > Measurements > Signal Statistics. Alternatively, in the scope toolbar, click the Signal Statistics button.

The statistics shown are:

  • Max — The maximum or largest value within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the MATLAB max function reference.

  • Min — The minimum or smallest value within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the MATLAB min function reference.

  • Peak to Peak — The difference between the maximum and minimum values within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox™ peak2peak function reference.

  • Mean —The average or mean of all the values within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the MATLAB mean function reference.

  • Median — The median value within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the MATLAB median function reference.

  • RMS — Shows the difference between the maximum and minimum values within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox rms function reference.

When you use the zoom options in the Scope, the Signal Statistics measurements automatically adjust to the time range shown in the display. For example, you can zoom in on one pulse to make the Signal Statistics panel display information about only that particular pulse.

The Signal Statistics measurements are valid for any units of the input signal. The letter after the value associated with each measurement represents the appropriate International System of Units (SI) prefix, such as m for milli-. For example, if the input signal is measured in volts, an m next to a measurement value indicates that this value is in units of millivolts.

Bilevel Measurements Panel

The Bilevel Measurements panel shows information about transitions, overshoots, undershoots, and cycles for a selected signal. You can choose to hide or display the Bilevel Measurements panel. In the scope menu, select Tools > Measurements > Bilevel Measurements. Alternatively, in the scope toolbar, you can select the Bilevel Measurements button.

When you use the zoom options in the Scope, the bilevel measurements automatically adjust to the time range shown in the display. For example, you can zoom in on one rising edge to make the Bilevel Measurements panel display information about only that particular rising edge. This feature does not apply to the High and Low measurements.

The Bilevel Measurements panel is separated into four panes, labeled Settings, Transitions, Overshoots / Undershoots, and Cycles. You can expand each pane to see the available options.

The Settings pane enables you to modify the properties used to calculate various measurements involving transitions, overshoots, undershoots, and cycles. You can modify the high-state level, low-state level, state-level tolerance, upper-reference level, mid-reference level, and lower-reference level, as shown in the following figure.

 Bilevel Measurements Plot

  • Auto State Level — When this check box is selected, the Bilevel measurements panel autodetects the high- and low- state levels of a bilevel waveform. For more information on the algorithm this option uses, see the Signal Processing Toolbox statelevels function reference. When this check box is cleared, you can enter in values for the high- and low- state levels manually.

    • High — Manually specify the value for a positive polarity or high-state level.

    • Low — Manually specify the value for a negative polarity or low-state level.

  • State Level Tolerance — Tolerance within which the initial and final levels of each transition must be within their respective state levels. This value is expressed as a percentage of the difference between the high- and low-state levels.

  • Upper Ref Level — Used to compute the end of the rise-time measurement or the start of the fall time measurement. This value is expressed as a percentage of the difference between the high- and low-state levels.

  • Mid Ref Level — Used to determine when a transition occurs. This value is expressed as a percentage of the difference between the high- and low- state levels. The mid-reference level is shown as a horizontal line, and its corresponding mid-reference level instant is shown as a vertical line.

  • Lower Ref Level — Used to compute the end of the fall-time measurement or the start of the rise-time measurement. This value is expressed as a percentage of the difference between the high- and low-state levels.

  • Settle Seek — The duration after the mid-reference level instant when each transition occurs used for computing a valid settling time. This value is equivalent to the input parameter, D, which you can set when you run the settlingtime function. The settling time is displayed in the Overshoots/Undershoots pane.

The Transitions pane displays calculated measurements associated with the input signal changing between its two possible state level values, high and low. The Transition measurements assume that the amplitude of the input signal is in units of volts. Convert all input signals to volts for the Transition measurements to be valid.

A positive-going transition, or rising edge, in a bilevel waveform is a transition from the low-state level to the high-state level. A positive-going transition has a slope value greater than zero. Whenever there is a plus sign (+) next to a text label, this symbol refers to measurement associated with a rising edge, a transition from a low-state level to a high-state level.

A negative-going transition, or falling edge, in a bilevel waveform is a transition from the high-state level to the low-state level. A negative-going transition has a slope value less than zero. Whenever there is a minus sign (–) next to a text label, this symbol refers to measurement associated with a falling edge, a transition from a high-state level to a low-state level.

  • High — The high-amplitude state level of the input signal over the duration of the Time Span parameter. You can set Time Span in the Main pane of the Visuals—Time Domain Properties dialog box. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox statelevels function reference.

  • Low — The low-amplitude state level of the input signal over the duration of the Time Span parameter. You can set Time Span in the Main pane of the Visuals—Time Domain Properties dialog box. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox statelevels function reference.

  • Amplitude — Difference in amplitude between the high-state level and the low-state level.

  • + Edges — Total number of positive-polarity, or rising, edges counted within the displayed portion of the input signal.

  • + Rise Time — Average amount of time required for each rising edge to cross from the lower-reference level to the upper-reference level. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox risetime function reference.

  • + Slew Rate — Average slope of each rising-edge transition line within the upper- and lower-percent reference levels in the displayed portion of the input signal. The region in which the slew rate is calculated appears in gray.

    For more information on the algorithm this measurement uses, see the Signal Processing Toolbox slewrate function reference.

  • – Edges — Total number of negative-polarity or falling edges counted within the displayed portion of the input signal.

  • – Fall Time — Average amount of time required for each falling edge to cross from the upper-reference level to the lower-reference level. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox falltime function reference.

  • – Slew Rate — Average slope of each falling edge transition line within the upper- and lower-percent reference levels in the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox slewrate function reference.

The Overshoots/Undershoots pane displays calculated measurements involving the distortion and damping of the input signal. Overshoot and undershoot refer to the amount that a signal, respectively, exceeds and falls below its final steady-state value. Preshoot refers to the amount before a transition that a signal varies from its initial steady-state value. This figure shows preshoot, overshoot, and undershoot for a rising-edge transition.

 Overshoot/Undershoot Plot

  • + Preshoot — Average lowest aberration in the region immediately preceding each rising transition.

  • + Overshoot — Average highest aberration in the region immediately following each rising transition. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox overshoot function reference.

  • + Undershoot — Average lowest aberration in the region immediately following each rising transition. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox undershoot function reference.

  • + Settling Time — Average time required for each rising edge to enter and remain within the tolerance of the high-state level for the remainder of the settle seek duration. The settling time is the time after the mid-reference level instant when the signal crosses into and remains in the tolerance region around the high-state level. This crossing is illustrated in the following figure.

     Settling Time Plot

    You can modify the settle seek duration parameter in the Settings pane. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox settlingtime function reference.

  • – Preshoot — Average highest aberration in the region immediately preceding each falling transition.

  • – Overshoot — Average highest aberration in the region immediately following each falling transition. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox overshoot function reference.

  • – Undershoot — Average lowest aberration in the region immediately following each falling transition. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox undershoot function reference.

  • – Settling Time — Average time required for each falling edge to enter and remain within the tolerance of the low-state level for the remainder of the settle seek duration. The settling time is the time after the mid-reference level instant when the signal crosses into and remains in the tolerance region around the low-state level. You can modify the settle seek duration parameter in the Settings pane. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox settlingtime function reference.

The Cycles pane displays calculated measurements of to repetitions or trends in the displayed portion of the input signal.

  • Period — Average duration between adjacent edges of identical polarity within the displayed portion of the input signal. The Bilevel measurements panel calculates period as follows. It takes the difference between the mid-reference level instants of the initial transition of each positive-polarity pulse and the next positive-going transition. These mid-reference level instants appear as red dots.

    For more information on the algorithm this measurement uses, see the Signal Processing Toolbox pulseperiod function reference.

  • Frequency — Reciprocal of the average period. Whereas period is typically measured in some metric form of seconds, or seconds per cycle, frequency is typically measured in hertz or cycles per second.

  • + Pulses — Number of positive-polarity pulses counted.

  • + Width — Average duration between rising and falling edges of each positive-polarity pulse within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox pulsewidth function reference.

  • + Duty Cycle — Average ratio of pulse width to pulse period for each positive-polarity pulse within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox dutycycle function reference.

  • – Pulses — Number of negative-polarity pulses counted.

  • – Width — Average duration between rising and falling edges of each negative-polarity pulse within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox pulsewidth function reference.

  • – Duty Cycle — Average ratio of pulse width to pulse period for each negative-polarity pulse within the displayed portion of the input signal. For more information on the algorithm this measurement uses, see the Signal Processing Toolbox dutycycle function reference.

Peak Finder Panel

The Peak Finder panel displays the maxima, showing the x-axis values at which they occur. This panel allows you to modify the settings for peak threshold, maximum number of peaks, and peak excursion. You can choose to hide or display the Peak Finder panel. In the scope menu, select Tools > Measurements > Peak Finder. Alternatively, in the scope toolbar, select the Peak Finder button.

The Peak finder panel is separated into two panes, labeled Settings and Peaks. You can expand each pane to see the available options.

The Settings pane enables you to modify the parameters used to calculate the peak values within the displayed portion of the input signal. For more information on the algorithms this pane uses, see the Signal Processing Toolbox findpeaks function reference.

  • Peak Threshold — The level above which peaks are detected. This setting is equivalent to the MINPEAKHEIGHT parameter, which you can set when you run the findpeaks function.

  • Max Num of Peaks — The maximum number of peaks to show. The value you enter must be a scalar integer from 1 through 99. This setting is equivalent to the NPEAKS parameter, which you can set when you run the findpeaks function.

  • Min Peaks Distance — The minimum number of samples between adjacent peaks. This setting is equivalent to the MINPEAKDISTANCE parameter, which you can set when you run the findpeaks function.

  • Peak Excursion — The minimum height difference between a peak and its neighboring samples The peak excursion setting is equivalent to the THRESHOLD parameter, which you can set when you run the findpeaks function.

  • Label Format — The coordinates to display next to the calculated peak values on the plot. To see peak values, expand the Peaks pane and select the check boxes associated with individual peaks of interest. By default, both x-axis and y-axis values are displayed on the plot. Select which axes values you want to display next to each peak symbol on the display.

    • X+Y — Display both x-axis and y-axis values.

    • X — Display only x-axis values.

    • Y — Display only y-axis values.

The Peaks pane displays all of the largest calculated peak values. It also shows the coordinates at which the peaks occur, using the parameters you define in the Settings pane. You set the Max Num of Peaks parameter to specify the number of peaks shown in the list.

The numerical values displayed in the Value column are equivalent to the pks output argument returned when you run the findpeaks function. The numerical values displayed in the second column are similar to the locs output argument returned when you run the findpeaks function.

The Peak Finder displays the peak values in the Peaks pane. By default, the Peak Finder panel displays the largest calculated peak values in the Peaks pane in decreasing order of peak height. Use the sort descending button ( ) to rearrange the category and order by which Peak Finder displays peak values. Click this button again to sort the peaks in ascending order instead. When you do so, the arrow changes direction to become the sort ascending button ( ). A filled sort button indicates that the peak values are currently sorted in the direction of the button arrow. If the sort button is not filled ( ), then the peak values are sorted in the opposite direction of the button arrow. The Max Num of Peaks parameter still controls the number of peaks listed.

Use the check boxes to control which peak values are shown on the display. By default, all check boxes are cleared and the Peak Finder panel hides all the peak values. To show all the peak values on the display, select the check box in the top-left corner of the Peaks pane. To hide all the peak values on the display, clear this check box. To show an individual peak, select the check box directly to the left of its Value listing. To hide an individual peak, clear the check box directly to the left of its Value listing.

The Peaks are valid for any units of the input signal. The letter after the value associated with each measurement indicates the abbreviation for the appropriate International System of Units (SI) prefix, such as m for milli-. For example, if the input signal is measured in volts, an m next to a measurement value indicates that this value is in units of millivolts.

Style Dialog Box

Select View > Style or the Style button ( ) in the dropdown below the Configuration Properties button to open the Style dialog box. In this dialog box, you can change the figure colors, background axes colors, foreground axes colors, and properties of lines in a display.

Properties

The Style dialog box allows you to modify the following properties of the scope figure:

Figure color

Specify the color that you want to apply to the background of the scope figure. By default, the figure color is gray.

Plot type

Specify the type of plot to use. The default setting is Line. Valid values for Plot type are:

  • Line — Displays input signal as lines connecting each of the sampled values. This approach is similar to the functionality of the MATLAB line or plot function.

  • Stairs — Displays input signal as a stairstep graph. A stairstep graph is made up of only horizontal lines and vertical lines. Each horizontal line represents the signal value for a discrete sample period and is connected to two vertical lines. Each vertical line represents a change in values occurring at a sample. This approach is equivalent to the MATLAB stairs function. Stairstep graphs are useful for drawing time history graphs of digitally sampled data.

  • Auto — Displays input signal as a line graph for a continuous signal and displays input signal as a stair step graph for a discrete signal.

This property is Tunable.

Active display

Specify the active display as an integer to get and set relevant properties. The number of a display corresponds to its column-wise placement index. Set this property to control which display has its axes colors, line properties, marker properties, and visibility changed. Tunable

When you use the Layout option to tile the window into multiple displays, the display highlighted in blue is referred to as the active display. The default setting is 1.

Axes colors

Specify the color that you want to apply to the background of the axes for the active display.

Properties for line

Specify the signal for which you want to modify the visibility, line properties, and marker properties.

Visible

Specify whether the selected signal on the active display is visible. If you clear this check box, the line disappears.

Line

Specify the line style, line width, and line color for the selected signal on the active display.

Marker

Specify marks for the selected signal on the active display to show at data points. This property is similar to the Marker property for the MATLAB Handle Graphics® plot objects. Choose any of the marker symbols from the dropdown list.

Visuals — Time Domain Properties

The Visuals — Time Domain Properties dialog box controls the visual configuration settings of the Time Scope displays. From the Time Scope menu, select View > Configuration Properties to open this dialog box.

Main Pane

The Main pane of the Time Scope Visuals—Time Domain Properties dialog box appears as follows.

Input processing

Specify whether the Time Scope treats the input signal as Columns as channels (frame based) or Elements as channels (sample based).

Frame-based processing is only available for discrete input signals. For more information about frame-based input channels, see the What Is Frame-Based Processing? section in the DSP System Toolbox™ documentation. For an example that uses the Time Scope block and frame-based input signals, see the Display Time-Domain Data section in the DSP System Toolbox documentation.

Time span

Specify the time span, either by selecting a predefined option or by entering a numeric value in seconds. You can select one of the following options:

  • Auto — In this mode, the Time Scope automatically calculates the appropriate value for time span from the difference between the simulation Start time and Stop time properties. This option is available only for the Time Scope block but not for the dsp.TimeScope System object.

  • One frame period — In this mode, the Time Scope uses the frame period of the input signal to the Time Scope block. This option is only available when the Input processing parameter is set to Columns as channels (frame based). This option is not available when you set the Input processing parameter to Elements as channels (sample based).

  • <user defined> — In this mode, you specify the time span by replacing the text <user defined> with a numeric value in seconds.

The scope sets the time-axis limits using the value of this property and the value of the Time display offset property. For example, if you set the Time display offset to 5e-6 and the Time span to 25e-6, the scope sets the time-axis limits as shown in the following figure.

This property is Tunable.

Time span overrun action

Specify how the scope displays new data beyond the visible time span. You can select one of the following options:

  • Wrap — In this mode, the scope displays new data until the data reaches the maximum time-axis limit. When the data reaches the maximum time-axis limit of the scope window, the scope clears the display. The scope then updates the time offset value and begins displaying subsequent data points starting from the minimum time-axis limit.

  • Scroll — In this mode, the scope scrolls old data to the left to make room for new data on the right side of the scope display. This mode is graphically intensive and can affect run-time performance. However, it is beneficial for debugging and monitoring time-varying signals.

This property is Tunable.

The default setting is Wrap.

Time units

Specify the units used to describe the time-axis. The default setting is Metric. You can select one of the following options:

  • Metric — In this mode, Time Scope converts the times on the time-axis to some metric units such as milliseconds, microseconds, days, etc. Time Scope chooses the appropriate metric units, based on the minimum time-axis limit and the maximum time-axis limit of the scope window.

  • Seconds — In this mode, Time Scope always displays the units on the time-axis as seconds.

  • None — In this mode, Time Scope displays no units on the time-axis. Time Scope shows only the word Time on the time-axis.

This property is Tunable.

Time display offset

This property allows you to offset the values displayed on the time-axis by a specified number of seconds. When you specify a scalar value, the scope offsets all channels equally. When you specify a vector of offset values, the scope offsets each channel independently. Tunable.

When you specify a Time display offset vector of length N, the scope offsets the input channels as follows:

  • When N is equal to the number of input channels, the scope offsets each channel according to its corresponding value in the offset vector.

  • When N is less than the number of input channels, the scope applies the values you specify in the offset vector to the first N input channels. The scope does not offset the remaining channels.

  • When N is greater than the number of input channels, the scope offsets each input channel according to the corresponding value in the offset vector. The scope ignores all values in the offset vector that do not correspond to a channel of the input.

The scope computes the time-axis range using the values of the Time display offset and Time span properties. For example, if you set the Time display offset to 5e-6 and the Time span to 25e-6, the scope sets the time-axis limits as shown in the following figure.

Similarly, when you specify a vector of values, the scope sets the minimum time-axis limit using the smallest value in the vector. To set the maximum time-axis limit, the scope sums the largest value in the vector with the value of the Time span property. For more information, see Signal Display.

Time-axis labels

Specify how to display the time units used to describe the time-axis. The default setting is All. You can select one of the following options:

  • All — In this mode, the time-axis labels appear in all displays.

  • None — In this mode, the time-axis labels do not appear in the displays.

  • Bottom Displays Only — In this mode, the time-axis labels appear in only the bottom row of the displays.

Tunable.

Show time-axis label

Select to turn on time-axis label display.

Tunable.

Maximize axes

Specify whether to display the scope in maximized axes mode. In this mode, each of the axes is expanded to fit into the entire display. To conserve space, labels do not appear in each display. Instead, tick-mark values appear on top of the plotted data. You can select one of the following options:

  • Auto — In this mode, the axes appear maximized in all displays only if the Title and YLabel properties are empty for every display. If you enter any value in any display for either of these properties, the axes are not maximized.

  • On — In this mode, the axes appear maximized in all displays. Any values entered into the Title and YLabel properties are hidden.

  • Off — In this mode, none of the axes appear maximized.

This property is Tunable.

The default setting is Auto.

Display Pane

The Display pane of the Visuals—Time Domain Properties dialog box appears as follows.

Active display

Specify the active display as an integer to get and set relevant properties. The number of a display corresponds to its column-wise placement index. Set this property to control which display has its axes colors, line properties, marker properties, and visibility changed. Tunable

When you use the Layout option to tile the window into multiple displays, the display highlighted in blue is referred to as the active display. The default setting is 1.

Title

Specify the active display title as a string. By default, the active display has no title. Tunable.

Show legend

Select this check box to show the legend in the display. The channel legend displays a name for each channel of each input signal. When the legend appears, you can place it anywhere inside of the scope window. To turn off the legend, clear the Show legend check box. This parameter applies only when the Spectrum Type is Power or Power density. Tunable

You can edit the name of any channel in the legend. To do so, double-click the current name, and enter a new channel name. By default, if the signal has multiple channels, the scope uses an index number to identify each channel of that signal. To change the appearance of any channel of any input signal in the scope window, from the scope menu, select View > Style.

Show grid

When you select this check box, a grid appears in the display of the scope figure. To hide the grid, clear this check box. Tunable

Plot signals as magnitude and phase

When you select this check box, the scope splits the display into a magnitude plot and a phase plot. By default, this check box is cleared. If the input signal has complex values, the scope plots the real and imaginary portions on the same axes. These real and imaginary portions appear as different-colored lines on the same axes, as shown in the following figure.

Selecting this check box and clicking the Apply or OK button changes the display. The magnitude of the input signal appears on the top axes and its phase, in degrees, appears on the bottom axes. See the following figure.

This feature is useful for complex-valued input signals. If the input is a real-valued signal, selecting this check box returns the absolute value of the signal for the magnitude. The phase is 0 degrees for nonnegative input and 180 degrees for negative input. Tunable

Y-limits (Minimum)

Specify the minimum value of the y-axis. Tunable

When you select the Plot signal(s) as magnitude and phase check box, the value of this property always applies to the magnitude plot on the top axes. The phase plot on the bottom axes is always limited to a minimum value of -180 degrees.

Y-limits (Maximum)

Specify the maximum value of the y-axis. Tunable

When you select the Plot signal(s) as magnitude and phase check box, the value of this property always applies to the magnitude plot on the top axes. The phase plot on the bottom axes is always limited to a maximum value of 180 degrees.

Y-label

Specify as a string the text for the scope to display to the left of the y-axis. Tunable

This property becomes invisible when you select the Plot signal(s) as magnitude and phase check box. When you enable that property, the y-axis label always appears as Magnitude on the top axes and Phase on the bottom axes.

Tools — Axes Scaling Properties

The Axes Scaling Properties: Time Scope dialog box provides you with the ability to automatically zoom in on and zoom out of your data, and to scale the axes of the Time Scope. In the Time Scope menu, select Tools > Axes Scaling Options to open this dialog box.

Properties

The Tools—Axes Scaling Properties dialog box appears as follows.

Axes scaling

Specify when the scope automatically scales the axes. You can select one of the following options:

  • Manual — When you select this option, the scope does not automatically scale the axes. You can manually scale the axes in any of the following ways:

    • Select Tools > Axes Scaling Properties.

    • Press one of the Scale Axis Limits toolbar buttons.

    • When the scope figure is the active window, press Ctrl and A simultaneously.

  • Auto — When you select this option, the scope scales the axes as needed, both during and after simulation. Selecting this option shows the Do not allow Y-axis limits to shrink check box.

  • After N Updates — Selecting this option causes the scope to scale the axes after a specified number of updates. This option is useful and more efficient when your scope display starts with one axis scale, but quickly reaches a different steady state axis scale. Selecting this option shows the Number of updates edit box.

By default, this property is set to Auto. This property is Tunable.

Do not allow Y-axis limits to shrink

When you select this property, the y-axis is allowed only to grow during axes scaling operations. If you clear this check box, the y-axis or color limits may shrink during axes scaling operations.

This property appears only when you select Auto for the Axis scaling property. When you set the Axes scaling property to Manual or After N Updates, the y-axis or color limits are allowed to shrink. Tunable.

Number of updates

Specify as a positive integer the number of updates after which to scale the axes. This property appears only when you select After N Updates for the Axes scaling property. Tunable.

Scale axes limits at stop

Select this check box to scale the axes when the simulation stops. The y-axis is always scaled. The x-axis limits are only scaled if you also select the Scale X-axis limits check box.

Y-axis Data range (%)

Set the percentage of the y-axis that the scope uses to display the data when scaling the axes. Valid values are from 1 through 100. For example, if you set this property to 100, the Scope scales the y-axis limits such that your data uses the entire y-axis range. If you then set this property to 30, the scope increases the y-axis range such that your data uses only 30% of the y-axis range. Tunable.

Y-axis Align

Specify where the scope aligns your data along the y-axis when it scales the axes. You can select Top, Center, or Bottom. Tunable.

Autoscale X-axis limits

Check this box to allow the scope to scale the x-axis limits when it scales the axes. If Axes scaling is set to Auto, checking Scale X-axis limits only scales the data currently within the axes, not the entire signal in the data buffer. Tunable.

X-axis Data range (%)

Set the percentage of the x-axis that the scope uses to display the data when scaling the axes. Valid values are from 1 through 100. For example, if you set this property to 100, the scope scales the x-axis limits such that your data uses the entirex-axis range. If you then set this property to 30, the scope increases the x-axis range such that your data uses only 30% of the x-axis range. Use the x-axis Align property to specify data placement along the x-axis.

This property appears only when you select the Scale X-axis limits check box. Tunable.

X-axis Align

Specify how the scope aligns your data along the x-axis: Left, Center, or Right. This property appears only when you select the Scale X-axis limits check box. Tunable.

Sources — Streaming Properties

The Sources – Streaming Properties dialog box lets you control the number of input signal samples that Time Scope holds in memory. In the Time Scope menu, select View > Data History Properties to open this dialog box.

Data History Properties

Buffer length

Specify the size of the buffer that the scope holds in its memory cache. Memory is limited by available memory on your system. If your signal has M rows of data and N data points in each row, M x N is the number of data points per time step. Multiply this result by the number of time steps for your model to obtain the required buffer length. For example, if you have 10 rows of data with each row having 100 data points and your run will be 10 time steps, you should enter 10,000 (which is 10 x 100 x 10) as the buffer length.

The default setting is 50000.

Examples

The first few examples illustrate how to use the Time Scope object to view a variety of input signals in the time domain.

The remaining examples demonstrate how to use the Measurements Panels in the Time Scope GUI to glean information about the input signals.

Example: Display Simple Sine Wave Input Signal

Construct dsp.SineWave and dsp.TimeScope objects. Run the step method to display the signal.

hsin = dsp.SineWave('Frequency',100, 'SampleRate', 1000);
hsin.SamplesPerFrame = 10;
hts1 = dsp.TimeScope('SampleRate', hsin.SampleRate,'TimeSpan', 0.1);
for ii = 1:10
     x = step(hsin);
     step(hts1, x);
end

Run the release method to let property values and input characteristics change. The scope automatically scales the axes.

release(hts1)

Run the MATLAB clear function to close the Time Scope window.

clear hts1 hsin x;

Example: View Sine Wave Input Signals at Different Sample Rates and Offsets

Construct dsp.SineWave and dsp.FirDecimator objects. Use the dsp.FirDecimator object to create a new signal that equals the original signal, but decimated by a factor of 2. Construct a dsp.TimeScope object with 2 input ports. Run the step method to display the signal.

Fs = 1000;  % Sampling frequency
hsin1 = dsp.SineWave('Frequency',50,...
   'SampleRate',Fs, ...
   'SamplesPerFrame', 100);
% Create FIRDecimator System object to decimate by 2
hfilt = dsp.FIRDecimator;
% Create TimeScope System object with 2 input ports (channels)
hts2 = dsp.TimeScope(2, [Fs Fs/2], ...
   'TimeDisplayOffset', [0 38/Fs], ...
   'TimeSpan', 0.25, ...
   'YLimits',[-1 1], ...
   'ShowLegend', true);
for ii = 1:2
     xsine = step(hsin1);
     xdec = step(hfilt,xsine);
     step(hts2, xsine, xdec);
end

Run the release method to let property values and input characteristics change. The scope automatically scales the axes.

release(hts2)

Run the MATLAB clear function to close the Time Scope window.

clear hts2 Fs hsin1 hfilt ii xsine xdec;

Example: Display Complex-valued Input Signal

Create a vector representing a complex-valued sinusoidal signal and construct a dsp.TimeScope object. Run the step method to display the signal.

fs = 1000; t = (0:1/fs:10)';
CxSine = cos(2*pi*0.2*t) + 1i*sin(2*pi*0.2*t);
CxSineSum = cumsum(CxSine);
figure(101); subplot(2,1,1); stairs(t,abs(CxSineSum));  % Plot magnitude
subplot(2,1,2); stairs(t,(180/pi)*angle(CxSineSum));    % Plot phase in deg
h1 = dsp.TimeScope(1, fs, 'TimeSpanSource', 'Auto');
step(h1,CxSineSum);

By default, when the input is a complex-valued signal, Time Scope plots the real and imaginary portions on the same axes. These real and imaginary portions appear as different-colored lines on the same axes within the same active display, as shown in the following figure.

Change the PlotAsMagnitudePhase property to true.

set(h1,'PlotAsMagnitudePhase',true);

Time Scope now plots the magnitude and phase of the input signal on two separate axes within the same active display. The active display changes to show the magnitude of the input signal on the top axes and its phase, in degrees, on the bottom axes, as shown in the following figure.

Run the release method to let property values and input characteristics change. The scope automatically scales the axes.

release(h1);

Run the MATLAB clear function to close the Time Scope window, and remove the variables you created from the workspace.

close(101);
clear h1 fs t CxSine CxSineSum

Example: Display Input Signal of Changing Size

Create a vector that represents a two-channel constant signal. Create another vector that represents a three-channel constant signal. Construct a dsp.TimeScope object with 2 input ports. Run the step method to display the signal.

fs = 10;
sigdim2 = [ones(5*fs,1), 1+ones(5*fs,1)];                   % 2-dim 0-5s
sigdim3 = [2+ones(5*fs,1), 3+ones(5*fs,1), 4+ones(5*fs,1)]; % 3-dim 5-10s
h2 = dsp.TimeScope(2, fs, 'TimeSpanSource', 'Property');
set(h2,'PlotType','Stairs');
set(h2,'TimeSpanOverrunAction','Scroll');
set(h2,'TimeDisplayOffset',[0,0,5]);
step(h2,[sigdim2; sigdim3(:,1:2)], sigdim3(:,3));

In this example, the size of the input signal to the Time Scope block changes as the simulation progresses. When the simulation time is less than 5 seconds, Time Scope plots only the signal sigdim2, which has two channels. After 5 seconds, Time Scope also plots the signal sigdim3, which has three channels.

Run the release method to let property values and input characteristics change. The scope automatically scales the axes.

release(h2);

Run the MATLAB clear function to close the Time Scope window, and remove the variables you created from the workspace.

clear h2 fs sigdim2 sigdim3

Example: Use Bilevel Measurements Panel with Clock Input Signal

Load the clock data into the variable, x. Find the sample time, ts.

load clockex;
ts = t(2)-t(1);

Construct a dsp.TimeScope object. Run the step method to display the signal.

h4 = dsp.TimeScope(1, 1/ts, 'TimeSpanSource','Auto');
step(h4,x);

Run the release method to let property values and input characteristics change. The scope automatically scales the axes.

release(h4);

To show the Bilevel Measurements panel, in the Time Scope menu, select Tools > Measurements > Bilevel Measurements. To collapse the Transitions pane, click the pane collapse button ( ) next to that label. To expand the Settings pane and the Overshoots / Undershoots pane, click the pane expand button ( ) next to each label. The Time Scope figure appears as shown in the following figure.

As you can see in the figure, the value for the rising edge Settling Time parameter is initially not displayed. The reason for this is that the default value for the Settle Seek parameter is too large for this example. In this case, the settle seek time is longer than the entire simulation duration. Enter a value for settle seek of 2e-6, and press the Enter key. Time Scope now displays a rising edge settling time value of 118.392 ns.

This settling time value displayed is actually the statistical average of the settling times for all five rising edges. To show the settling time for only one rising edge, you can zoom in on that transition. In the Time Scope toolbar, click the Zoom X button ( ). Then, click the display near a value of 2 microseconds on the time-axis. Drag to the right and release near a value of 4 microseconds on the time-axis. Time Scope updates the rising edge Settling Time value to reflect the new time window, as shown in the following figure.

Run the MATLAB clear function to close the Time Scope window, and remove the variables you created from the workspace.

clear h4 x t ts

Example: Find Heart Rate Using Peak Finder Panel with ECG Input Signal

First, create the electrocardiogram (ECG) signal.

x1 = 3.5*ecg(2700).';
y1 = sgolayfilt(kron(ones(1,13),x1),0,21);
n = (1:30000)';
del = round(2700*rand(1));
mhb = y1(n + del);
ts = 0.00025;

This example uses the Savitzky-Golay filter in Signal Processing Toolbox. For more information, see the sgolayfilt function reference page or run the sgolaydemosgolaydemo example.

Construct a dsp.TimeScope object. Run the step method to display the signal.

h5 = dsp.TimeScope(1, 1/ts, 'TimeSpanSource','Auto');
step(h5,mhb);

Run the release method to let property values and input characteristics change. The scope automatically scales the axes.

release(h5);

To show the Peak Finder panel, in the Time Scope menu, select Tools > Measurements > Peak Finder. To expand the Settings pane, click the pane expand button ( ) next to that label. Enter a value for Max Num of Peaks of 10, and press the Enter key. Time Scope now displays in the Peaks pane a list of 10 peak amplitude values, and the times at which they occur, as shown in the following figure.

As you can see from the list of peak values, there is a constant time difference of 0.675 seconds between each heartbeat. Therefore, the heart rate of the ECG signal is given by the following equation˙.

Run the MATLAB clear function to close the Time Scope window, and remove the variables you created from the workspace.

clear h5 x1 y1 n del mhb ts
Was this topic helpful?