Documentation

Time Scope

Display time-domain signals

Library

Sinks

Description

The Time Scope block displays signals in the time domain. The Time Scope block accepts input signals with the following characteristics:

  • Continuous or discrete sample time

  • Real- or complex-valued

  • Fixed or variable size dimensions

  • Floating- or fixed-point data type

  • N-dimensional

  • Simulink® enumerations

For information on the simulation modes supported by the scope and limitation on these modes, see Supported Simulation Modes. You can use the Time Scope block inside any subsystem or conditional subsystem. See Conditional Subsystems in the Simulink documentation for more information.

The following sections describe the features of the Time Scope:

Signal Display

Time Scope uses the simulation start time and stop time to determine the default time range. To define the length of simulation time for which the Time Scope displays data. see Time span and Time display offset parameters in the Configuration Properties Dialog Box.

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, clear the Simulation > Reduce Updates to Improve Performance check box. You can also use Ctrl+R to toggle this setting.

The scope shows the following status information.

    Note:   To prevent the scope from opening when you run your model, right-click the scope icon and select Comment Out. If the scope is already open, and you comment it out in the model. the scope displays, "No data can be shown because this scope is commented out." Select Uncomment to turn the scope back on.

The scope shows the following plot labels and status information.

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

You can choose to hide or display both the scope menus and the toolbar using the or button in the upper right corner of the scope. To hide or display the toolbar separately, use View > Toolbar in the scope menu.

You can choose to hide or display the entire Status Bar with View > Status Bar in the scope menu. The following items are in the Status Bar:

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

    • Initializing

    • Ready

    • Running

    • Paused

    The Simulation status 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.

  • 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 — When the model is running or simulation has been paused, the scope displays the current simulation time. This time is the amount of time that the Time Scope has spent processing the input. If the model simulation completes or is stopped, the scope displays the time at which the simulation stopped. You can choose to hide or display the entire Status Bar. From the Time Scope menu, select View > Status Bar.

      Note:   In some situations, the Time Scope block simulation time can be different from the Simulink simulation time. For multirate input signals, which have different sample times, and input signals originating from conditionally executed subsystems, such as Triggered and Enabled subsystems, separate Time Scope blocks can report different simulation times. The Time Scope block reports the simulation time as the time corresponding to the last point in the display.

To show and adjust multiple displays in your scope, see Display Multiple Signals in the Time Scope.

Measurements Panels

The Measurements panels are the panels that appear to the right side of the Time Scope GUI. Select the desired panels using Tools > Measurements in the scope toolbar or click the icons in the measurements dropdown.

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.

To open the Triggers panel, click the Triggers button ( ) or select Tools > Triggers in the scope menu.

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 an entire time span is viewable in the display. To prevent data from being shown twice, the scope suppresses the alignment of recurring events until an entire time span has elapsed since the previous update.

The Main pane lets you choose how often the display updates and in what position the trigger indicator appears.

  • Mode — Define how often the display updates.

    • Auto — The scope aligns and displays data from the latest trigger event. If no event is found after an entire time span has elapsed, then the scope displays the last available data. Use this mode to see your data and have it align whenever a trigger event occurs.

    • Normal — The scope aligns and displays data only from the latest trigger event. Use this mode to search for infrequently occurring events in your data.

    • Once — The scope displays data on the next encountered trigger event and freezes the display. The scope ignores subsequent data until you press the Rearm button.

    • Off — The scope does not make acquisitions. Triggering is disabled. This setting is equivalent to hiding the Triggers panel. You can use panning only if Mode is set to Off.

    If mode is set to either Normal or Once and the Triggers panel does not encounter any event, the display remains blank. Set Mode to Auto if you want the scope to display signal data regularly, in addition to trigger events.

  • Position (%) — Specify, as a percentage of the total time span within the active display, the horizontal position in which the trigger indicator appears. A position value of 0 corresponds to the minimum time-axis value at the far-left side of the display. A position value of 100 corresponds to the maximum time-axis value at the far-right side of the display. Drag the trigger position indicator to the left or right to adjust its position.

The Source/Type pane lets you choose the source of the trigger and the type of events on which to stop.

  • Source — Assign the trigger source to a particular channel. If you are viewing a magnitude/phase plot, you can trigger off the magnitude or the phase. If you are not viewing the magnitude/phase plot, you can trigger off the real or imaginary data. If the input signal has multiple channels, the scope assigns an index number to identify each channel of that signal. For more information, see Display Multiple Signals in the Time Scope.

  • Type — Select the type of trigger to use.

    • Edge — Trigger when the scope crosses a level threshold.

      For a rising edge, the scope enables the trigger event when the signal value becomes less than the level threshold minus hysteresis. The scope disables the trigger event when the signal becomes greater than the level threshold for the first time. The scope uses linear interpolation to generate a trigger event at the time when the signal crosses the level threshold.

       Rising Edge Trigger Plot

      For a falling edge, the scope enables the trigger event when the signal value becomes greater than the level threshold plus hysteresis. The scope disables the trigger event when the signal becomes less than the level threshold for the first time. The scope uses linear interpolation to generate a trigger event at the time when the signal crosses the level threshold.

       Falling Edge Trigger Plot

    • Pulse Width — Trigger when the scope encounters a pulse whose width falls inside or outside specified time limits. You specify the range of valid time limits in the Levels / Timing pane. For a positive-polarity pulse, the scope encounters a trigger event when the signal crosses the low threshold for the second time. The scope measures the pulse width as the time between the first and second crossings of the middle threshold, located halfway between the high and low thresholds.

       Pulse Width Trigger Plot

        Note:   A Glitch-type trigger looks for a pulse or spike with a duration less than a specified amount. You can implement a Glitch type trigger by using a Pulse Width type trigger and manually setting the Max Width parameter.

    • Transition — Trigger on a rising or falling edge that crosses two levels, high and low, inside or outside a specified time interval. You specify the range of valid transition times in the Levels / Timing pane. For a rising transition, the scope encounters the trigger event when the signal crosses the high threshold. The transition time is when the signal crosses the middle threshold, located halfway between the high and low thresholds.

       Transition Trigger Plot

    • Runt — Trigger on a runt pulse, which crosses one threshold, high or low, but not both. For a positive-polarity runt pulse, the scope encounters a trigger event when the signal crosses the low threshold the second time, without ever crossing the high threshold. The scope measures the runt width as the time between the first and second crossings of the low threshold, as shown in the following figure. The runt width is the Max WidthMin Width. Any runt pulse width that is less than the minimum width or greater than the maximum width does not generate a trigger event.

       Runt Trigger Plot

        Note:   You can also replicate a Runt-type trigger by using a Window-type trigger and setting Polarity to Inside.

    • Window — Trigger when the input signal stays within or outside the region defined by the high and low thresholds for a time.

      For an inside window, the scope encounters a trigger event when the signal enters and exits the inside region. For an outside window, the scope encounters a trigger event when the signal enters and exits the outside region.

       Inside Window Trigger Plot

       Outside Window Trigger Plot

      The scope encounters a trigger event when the signal crosses either the high or low threshold the second time.

    • Timeout — Trigger when the input signal stays above or below a voltage threshold longer than a specified time. For a timeout trigger with polarity set to Either and a timeout duration of 7.50 seconds, the scope can encounter the trigger event 7.50 seconds after the signal crosses the level threshold the last time. Alternatively, the scope can encounter the trigger event when the signal stays within the boundaries defined by the hysteresis for 7.50 seconds after the signal crosses the level threshold.

       Timeout Trigger Plots

  • Polarity — Select the polarity of the trigger type. The option you choose for Type determines the options available for polarity.

    For Type Edge:

    • Rising — Trigger on a rising edge, a transition from a low-state level to a high-state level.

    • Falling — Trigger on a falling edge, transition from a high-state level to a low-state level.

    • Either — Trigger on both rising edges and falling edges.

    For Type Pulse Width

    For Type Transition

    • Rise Time — Trigger based on how long the signal takes to transition from the low threshold to the high threshold.

    • Fall Time — Trigger based on how long the signal takes to transition from the high threshold to the low threshold.

    • Either — Trigger based on how long it takes to make either a rising or falling transition.

    Type Window

    • Inside — Trigger when the signal stays within the low and high levels for a specified time duration.

    • Outside — Trigger when the signal stays outside of the low and high levels for a specified time duration.

    • Either — Trigger on both inside and outside windows.

    For Type Timeout

    • Rising — Trigger when the signal does not cross the reference level from below.

    • Falling — Trigger when the signal does not cross the reference level from above.

    • Either — Trigger when the signal does not cross the reference level from either direction.

The Levels / Timing pane enables you to set the trigger level and hysteresis value. The option you choose for Type directly affects which level and timing parameters are available, as shown in the following table.

Trigger TypeLevel ParametersAuto-Level SettingTiming Parameters
EdgeLevel, HysteresisLevel = 50%n/a
Pulse Width, RuntHigh, LowHigh = 90%, Low = 10%Min Width, Max Width
Transition, WindowHigh, LowHigh = 90%, Low = 10%Min Time, Max Time
TimeoutLevel, Hysteresisn/aTimeout

  • Auto level — Enable the Triggers panel to choose automatically the level parameters. If you set the trigger type to Edge, this option sets the Level parameter to 50% of the range of the source signal. If you set the trigger type to Timeout, the Triggers panel does not show this option. Setting the trigger type to other menu choices results in High and Low parameter adjustment. Auto level sets the High parameter to 90% of the range of the source signal and the Low parameter to 10% of the range of the source signal.

  • Level (V) — Specify, in volts, the trigger level. This parameter is visible when you set Type to Edge or Timeout.

  • Hysteresis (V) — Specify the hysteresis or noise reject value in volts. This parameter is visible when you set Type to Edge or Timeout. If the signal jitters inside this range and briefly crosses the trigger level, the scope does not register an event. For an edge trigger with rising polarity, the scope ignores any times that the signal crosses the trigger level within the hysteresis region. You can reduce the hysteresis region by decreasing the hysteresis value. If the signal then hysteresis level a second time and rises to the trigger level, a second trigger event occurs. See the following figures.

     Hysteresis Plots

  • High (V) — Specify, in volts, the value that denotes a positive polarity, or high-state level. This parameter is visible when you set Type to Pulse Width, Transition, Runt, or Window.

  • Low (V) — Specify, in volts, the value that denotes a negative polarity, or low-state level. This parameter is visible when you set Type to Pulse Width, Transition, Runt, or Window.

  • Min Width (s) — Specify, in seconds, the minimum pulse width. This parameter is visible when you set Type to Pulse Width or Runt.

  • Max Width (s) — Specify, in seconds, the maximum pulse width. This parameter is visible when you set Type to Pulse Width or Runt.

  • Min Time (s) — Specify, in seconds, the minimum duration. This parameter is visible when you set Type to Transition or Window.

  • Max Time (s) — Specify, in seconds, the maximum duration. This parameter is visible when you set Type to Transition or Window.

  • Timeout (s) — Specify, in seconds, the timeout duration. This parameter is visible when you set Type to Timeout.

The Delay / Holdoff pane enables you to offset the trigger position by a fixed delay or set the minimum possible time between trigger events.

  • Delay (s) — Specify, in seconds, the fixed delay time by which to offset the trigger position. This parameter controls the amount of time the scope waits after a trigger event occurs before displaying a signal.

  • Holdoff (s) — Specify, in seconds, the minimum possible time between trigger events. This amount of time is used to suppress data acquisition after a valid trigger event is encountered. A trigger holdoff prevents repeated occurrences of a trigger from occurring during the portion of a burst that is of interest.

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.

Configuration Properties Dialog Box

The Configuration Properties dialog box controls various properties about the Time Scope displays. From the Time Scope menu, select View > Configuration Properties to open this dialog box. Alternatively, in the Time Scope toolbar, click the Configuration Properties button.

Main Pane

The Main pane of the Configuration Properties dialog box appears as follows.

Open at simulation start

Select this check box to ensure that the scope opens when the simulation starts. The following table summarizes the interaction between the Open at simulation start check box and the Scope figure.

Open at simulation startScope figure status when model savedScope figure opens
CheckedClosedAt simulation start
CheckedOpenAt model loading
Not checkedClosedOnly if you double-click the Scope block icon in the model
Not checkedOpenAt model loading

Display the full path

Select this check box to display in the title bar the path of this scope in this model.

Number of input ports

Specify the number of input ports to show on the left side of the scope block.

Layout

Specify the arrangement of scope displays in the scope window. The display highlighted in blue is referred to as the active display. The scope dialog boxes reference the active display.

Sample time

Specify the sampling time in seconds. If you enter -1, the sample time of the input signal is used.

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.

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.

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 scale, but quickly reaches a different steady state scale. Selecting this option shows the Number of updates edit box.

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

Axes scaling - Configure — Click the Configure link to the right of the Axes scaling property to see additional axes scaling properties. After you click this button, its label changes to Hide.

Number of updates

Enter the number of updates that occur before the scope scales the axes. This field shows only if you set Axes scaling to After N Updates.

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.

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.

Time Pane

The Time pane of the Configuration Properties dialog box appears as follows.

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 — Time Scope automatically calculates the minimum and maximum time-axis limits for time span.

    • Minimum time-axis limit = Simulation Start time

    • Maximum time-axis limit = Simulation Stop time + max(FrameRate * (FrameSize–1) / FrameSize)

    FrameSize is a vector equal to the number of rows in each input signal. FrameRate is the reciprocal of the sample time for each frame. The Time Scope System object calculates the minimum and maximum time-axis limits as follows:

    • 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. This property is Tunable.

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

The default setting is Metric.

Time display offset

You use this property 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 minimum to 5 seconds and the maximum to 30 seconds.

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 — The time-axis labels appear in all displays.

  • None — The time-axis labels do not appear in the displays.

  • Bottom Displays Only — The time-axis labels appear in only the bottom row of the displays.

Tunable.

Show time-axis label

Select this check box to show the time-axis label on the scope display. This check box is not available if Time-axis labels is None.

Display Pane

The Display pane of the Configuration 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. Enter %<SignalLabel> to use the signal labels in the Simulink Model as the axes titles. 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, the scope names each channel according to either its signal name or the name of the block from which it comes. If the signal has multiple channels, the scope uses an index number to identify each channel of that signal.

Time Scope does not display signal names that were labeled within an unmasked subsystem. You must label all input signals to the scope block that originate from an unmasked subsystem.

To change the appearance of any channel of any input signal in the scope window, from the 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.

Logging Pane

The Logging pane of the Configuration Properties dialog box appears as follows.

Limit data points to last

Specify the number of data points a Scope collects. The Scope relies on its data history for zooming and auto-scaling operations. If the number of data points is limited to 1,000 and the simulation generates 2,000 data points, only the last 1,000 are available for regenerating the display.

    Note:   If you do not select the Limit data points to last check box, the memory consumed by MATLAB steadily increases as the simulation stores the entire simulation history. An out of memory error can occur. Memory is limited by available memory on your system.

    For simulations with the Stop time set to inf, always select the Limit data points to last check box and enter a value.

Log data to workspace

When you select this check box, the scope logs data in the format you select in Save format.

The default setting is unchecked and no data is logged.

Variable name

Specify as a string the name of the variable in the MATLAB workspace to which the scope logs data. Any existing variable is overwritten.

Save format

Select the format in which to save logged data. Unless otherwise noted, you can save logged data for single- and multi-port data, sample-based and frame-based data, variable-size data, MAT-file logging, and external mode archiving. Valid values for Save format are:

  • Structure With Time — Save logged data as a structure with associated time information to the MATLAB workspace. Structure With Time format does not support single- or multi-port frame-based data.

  • Structure — Save logged data as a structure to the MATLAB workspace. Structure format does not support multi-port, frame-based data.

  • Array — Save logged data as an array with associated time information to the MATLAB workspace. Array format does not support multi-port sample-based data, single- or multi-port frame-based data, or variable-size data.

  • Dataset — Save logged data as a dataset object to the MATLAB workspace. Dataset format does not support variable-size data, MAT-file logging, or external mode archiving. See Simulink.SimulationData.Dataset for information.

Limit data points to last

When you select this check box, the scope limits the number of data points that it stores in a variable. Specify as a positive integer the number of data points at the end of the simulation data that the scope logs.

The default setting is unchecked, so that all data is logged. When checked, the default is the last 5000 data points.

Decimation

When you select this check box, the scope logs every Nth data point, where N is the decimation factor you specify.

The default setting is unchecked, so that logged data is not decimated. When checked, the default decimation rate is 2.

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.

Stepping Options

Select Simulation > Stepping Options to open the Simulation Stepping Options dialog box. If stepping back is disabled, in the Time Scope toolbar, click the step back button. This dialog box lets you pause the simulation at a specified time, enable stepping back, and specify options for stepping back. You can also modify the number of steps by which to step forward or backward.

The Simulation Stepping Options dialog box is not unique to Time Scope; it can also be launched from any Simulink model. To open this dialog box from any Simulink model, select Simulation > Stepping Options. For more information, see How Simulation Stepper Helps With Model Analysis and Simulation Stepping Options in the Simulink documentation.

Enable stepping back

Select this check box to enable the scope to take steps back in time. When selected, the scope enables the step back button ( ) on the simulation toolbar.

Maximum number of saved back steps

Specify the maximum number of back steps that the scope saves in memory. To maximize simulation speed, keep the value for this property small. The default setting is 10.

Interval between stored back steps

Specify the number of steps between back steps that the scope saves in memory for stepping backward. Set this property to a larger number to increase the time span of a back step without increasing the amount of memory used. The default setting is 1.

Move back/forward by

Specify the number of steps forward or backward that the Scope progresses when you click the step forward ( ) and step back ( ) buttons. The default setting is 1.

Pause simulation when time reaches

Select this check box to enable the Scope to pause the simulation when it reaches a specified time and then, specify the time at which you want the scope to pause.

Tools—Axes Scaling Properties

Select Tools > Axes Scaling Properties to open the Axes Scaling Properties dialog box. This dialog box provides you with the ability to zoom automatically in on and out of your data, and to scale the axes of the scope.

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.

Examples

The first few examples illustrate how to use the Time Scope block to view various input signals in the time domain.

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

Example: Display Complex-Valued Input Signal

At the MATLAB command prompt, type ex_timescope_complexinpex_timescope_complexinp to open the example model. The following Simulink model appears.

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. Run your model to see the time domain output, as shown in the following figure.

The Configuration Properties dialog box controls the visual configuration settings of the Scope displays. From the Scope menu, select View > Configuration Properties to open this dialog box. Go to the Display tab. Selecting the Plot signal(s) as magnitude and phase check box specifies the Scope to plot the magnitude and phase of the input signal. The magnitude and phase appear on two separate axes within the same active display. After you select this check box, click OK. The active display shows the magnitude of the input signal on the top axes. The signal phase, in degrees, appears on the bottom axes. See the following figure.

Example: Display Input Signal of Changing Size

At the MATLAB command prompt, type ex_timescope_varsizeex_timescope_varsize to open the example model. The following Simulink model appears.

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 the signal connected to the third input port of the Switch block, which has signal dimensions 1 by 2. After 5 seconds, Time Scope plots the signal connected to the first input port of the Switch block, which has signal dimensions 1 by 3. Run your model to see the time domain output, as shown in the following figure.

As you can see in the figure, the third line on the display, colored red, appears only after 5 seconds.

Example: Display Simulink Enumeration Input Signal

At the MATLAB command prompt, type ex_timescope_slenumex_timescope_slenum to open the example model. The following Simulink model appears.

In this example, Simulink imports the variable x, which is a Simulink enumeration data type, from the MATLAB workspace. This variable is created when the model loads because the commands that construct it reside in the model pre-load function. To view these commands, in the Simulink menu, select File > Model Properties > Model Properties. The following lines of MATLAB code appear when you click the Callbacks tab.

if ~exist('BasicColors','class')
    Simulink.defineIntEnumType('BasicColors', ...
        {'Red', 'Yellow', 'Blue'}, ...
        [0;1;2], ...
        'Description', 'Basic colors', ...
        'DefaultValue', 'Blue', ...
        'AddClassNameToEnumNames', true);
end
x = [BasicColors(0), BasicColors(2), BasicColors(1)];

The Signal from Workspace block has a Sample time of 3 seconds. Thus, the input signal changes to the next value in the vector x every 3 seconds. Run your model to see the time domain output, as shown in the following figure.

As you can see in the figure, the y-axis shows the units of amplitude in Red, Yellow, or Blue. The input signal value changes from Red to Blue at 3 seconds and from Blue to Yellow at 6 seconds.

Example: Use Bilevel Measurements Panel with Clock Input Signal

At the MATLAB command prompt, type ex_timescope_clockexex_timescope_clockex to open the example model. The following Simulink model appears.

In this example, Simulink imports the variable x from the MATLAB workspace. This variable is created when the model loads because the commands that construct it reside in the Preload function. To view these commands, in the Simulink menu, select File > Model Properties > Model Properties. The Model Properties dialog box appears. Click the Callbacks tab. The following lines of MATLAB code appear.

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

Run your model to see the time domain output. 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.

The 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 ( ). 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.

Example: Use Peak Finder to Find Heart Rate from ECG Inputl

At the MATLAB command prompt, type ex_timescope_heartbeatex_timescope_heartbeat to open the example model. The following Simulink model appears.

In this example, Simulink imports the variable mhb from the MATLAB workspace. The variable mhb is created when the model loads because the commands that construct mhb are in the Preload function. To view these commands, in the Simulink menu, select File > Model Properties > Model Properties. The Model Properties dialog box appears. Click the Callbacks tab. The following lines of MATLAB code appear.

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.

Run your model to see the time domain output. 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

Supported Data Types

PortSupported Data Types

Input

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

  • Simulink enumerations

Supported Simulation Modes

You can use the scope block in models running the following supported simulation modes.

ModeSupportedNotes and Limitations

Normal

Yes

 

Accelerator

Yes

 

Rapid Accelerator

Yes

You can use Rapid Accelerator mode as a method to increase the execution speed of your Simulink model. Rapid Accelerator mode creates an executable that includes the solver and model methods. This executable resides outside MATLAB and Simulink. Rapid Accelerator mode uses External mode to communicate with Simulink. For more information about Rapid Accelerator mode, see Acceleration in the Simulink documentation.

PIL

No

 

SIL

No

 

External

Yes

You can use External mode to tune block parameters in real time and view block outputs in many types of blocks and subsystems. External mode establishes communication between a host system, where the Simulink environment resides, and a target system, where the executable runs after code generation and the build process. For more information about External mode, see Host/Target Communication in the Simulink Coder™ documentation.

The scope does not support data archiving. See Set External Mode Data Archiving Parameters in the Simulink Desktop Real-Time™ documentation.

For more information about these modes, see How Acceleration Modes Work in the Simulink documentation.

Was this topic helpful?