Documentation Center

  • Trial Software
  • Product Updates

Choose and Configure Plotting Blocks

Sources of Data for Plotting

The table below indicates the kinds of data you can plot using various combinations of blocks and parameter values. To view or set the parameters, open the dialog box using the Parameters toolbar button in the plot window.

DataBlockParameter
Scalar signal vs. timeSignal ScopeX value from = Event time
Scalar signal vs. timeScope 
Scalar signal values without regard to timeSignal ScopeX value from = Index
Two scalar signals (X-Y plot)X-Y Signal Scope 
Attribute vs. timeAttribute ScopeX value from = Event time
Attribute values without regard to timeAttribute ScopeX value from = Index
Two attributes of same entity (X-Y plot)X-Y Attribute Scope 
Attribute vs. scalar signalGet Attribute block to assign the attribute value to a signal; followed by X-Y Signal Scope 
Scalar signal vs. attribute
Number of entity arrivals per time instantInstantaneous Entity Counting Scope 
Number of events per time instantInstantaneous Event Counting Scope 

Comparison of Blocks for Plotting Signals Against Time

The following table compares the capabilities of two blocks for plotting an event-based signal against time.

CapabilitySignal Scope Block (SimEvents Sinks library)Scope Block (Simulink® Sinks library)
Includes markers to show sample time hitsYesNo
Creates stair plotsYes (default plot)Yes
Creates stem plotsYes (alternative to stair plot)No
Creates continuous plotsYes (alternative to stair plot)No
Plots nonscalar signalsNoYes
Plots multiple signals per windowNoYes
Supports event-based signalsYesYes
Supports time-based signalsNoYes
Supports data types other than doubleNoYes
Available as a viewerNoYes

Markers in the Signal Scope plot are especially useful when your event-based signal:

  • Assumes zero-duration values

  • Assumes the same value in consecutive sample time hits at different times

The following plots of the same event-based signal illustrate the additional information that markers provide.

Signal Scope Plot with Markers

Scope Plot Without Markers

Insert and Connect Scope Blocks

The following table indicates the number, kind, and meaning of the input ports on each scope block.

BlockInput PortsPort Description
Signal ScopeOne signal input portSignal representing the data to plot
ScopeOne signal input portSignal representing the data to plot
X-Y Signal ScopeTwo signal input portsSignals representing the data to plot
Attribute ScopeOne entity input portEntities containing the attribute value to plot
X-Y Attribute ScopeOne entity input portEntities containing the attribute values to plot
Instantaneous Entity Counting ScopeOne entity input portEntities whose arrivals the block counts
Instantaneous Event Counting ScopeOne signal input portSignal whose signal-based events or function calls the block counts

The following figure shows some typical arrangements of scope blocks in a model. Notice that the blocks that have entity input ports can have optional entity output ports, and that signal lines can branch whereas entity connection lines cannot.

Connections Among Points in Plots

You can configure certain scope blocks in the SimEvents Sinks library to determine whether and how the block connects the points that it plots. The following table indicates the options. To view or change the parameter settings, open the dialog box using the Parameters toolbar button in the plot window.

Connection CharacteristicsSettingSample Plot
Stairstep across, then up or down. Also known as a zero-order hold.Plot type = Stair in the block dialog box
Vertical line from horizontal axis to point. No connection with previous or next plotted point. Also known as a stem plot.Plot type = Stem in the block dialog box
Line segment from point to point. Also known as a first-order hold.Plot type = Continuous in the block dialog box
No connection with other points or with axis. Also known as a scatter plot.Style > Line > None in the plot window

    Note:   If no initial output, data value, or arriving entity indicates a value to plot at T=0, the plot shows no point at T=0. In this case, the plot does not connect the first plotted point to the T=0 edge of the plot.

Vary Axis Limits Automatically

Using parameters on the Axes tab of the dialog box of scope blocks in the SimEvents Sinks library, you set the initial limits for the axes of the plot. Also, these parameters let you choose how the block responds when a point does not fit within the current axis limits:

  • If X value is beyond limit

  • If Y value is beyond limit

Choices for the parameters are in the table.

OptionDescription
Stretch axis limitsMaintain one limit while doubling the size of the displayed interval (without changing the size of the containing plot window)
Keep axis limits unchangedMaintain both limits, which means that points outside the limits do not appear
Shift axis limitsMaintain the size of the displayed interval while changing both limits

Other operations can still affect axis limits, such as the autoscale, zoom, and pan features.

To store the current limits of both axes for the next simulation, select Axes > Save axes limits from the plot window menu.

Cache Data in Scopes

The Data History tab of the dialog box of scope blocks in the SimEvents Sinks library lets you balance data visibility with simulation efficiency. Parameters on the Data History tab determine how much data the blocks cache during the simulation. Caching data lets you view it later, even if the scope is not open during the simulation. Caching less or no data accelerates the simulation and uses less memory.

If you set the Store data when scope is closed parameter to Limited, uncached data points disappear when:

  • The simulation ends

  • You interact with the plot after pausing the simulation (using Simulation > Pause, for example)

Examples Using Scope Blocks

The following examples use scope blocks to create different kinds of plots:

ExampleDescription
Plot the Queue-Length Signal and Observations from PlotsStairstep and continuous plots of statistical signals
Round-Robin Approach to Choosing InputsStem plot of data from an attribute
Preemption by High-Priority EntitiesUnconnected plot of a signal using dots
Set AttributesStairstep plots of data from attributes using Attribute Scope blocks as sinks
Synchronize Service Start Times with the ClockStem plots that count entities using Instantaneous Entity Counting Scope blocks with entity output ports
X-Y Signal Scope reference pageContinuous plot of two signals
X-Y Attribute Scope reference pageUnconnected plot of two attributes using x's as plotting markers

Was this topic helpful?