main content

(to be removed) time domain signal display and measurement -凯发k8网页登录

(to be removed) time domain signal display and measurement

description

note

dsp.timescope is not recommended. use instead. for more information, see compatibility considerations

the dsp.timescope system object™ displays time-domain signals. you can use the scope to measure signal values, find peaks, display bilevel measurements and statistics.

to see time-domain signals in the scope:

  1. create the dsp.timescope object and set its properties.

  2. call the object with arguments, as if it were a function.

to learn more about how system objects work, see what are system objects?

oscilloscope features:

  • — set triggers to sync repeating signals and pause the display when events occur.

  • — measure signal values using vertical and horizontal cursors.

  • — display the maximum, minimum, peak-to-peak difference, mean, median, and rms values of a selected signal.

  • — find maxima, showing the x-axis values at which they occur.

  • — measure transitions, overshoots, undershoots, and cycles.

for information on measurements and triggers, see .

scope display features:

  • multiple signals — plot multiple signals on the same y-axis (display) using multiple input ports.

  • multiple y-axes (displays) — display multiple y-axes. all the y-axes have a common time range on the x-axis.

  • modify parameters — modify scope parameter values before and during a simulation.

  • axis autoscaling — autoscaling during or at the end of a simulation. margins are drawn at the top and bottom of the axes.

creation

description

scope = dsp.timescope returns a time scope system object, scope. this object displays real- and complex-valued floating and fixed-point signals in the time domain.

scope = dsp.timescope(numinputs,samplerate) creates a time scope and sets the numinputports property to numinputs and the samplerate property to samplerate.

example

scope = dsp.timescope(___,name,value) sets properties specified as name,value pairs.

properties

unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. objects lock when you call them, and the function unlocks them.

if a property is tunable, you can change its value at any time.

for more information on changing property values, see .

frequently used

number of input ports, specified as a positive integer. each signal coming through a separate input becomes a separate channel in the scope. you must invoke the scope with the same number of inputs as the value of this property.

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

you can specify a scalar or 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.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

specify the time span, in seconds, as a positive, numeric scalar value. the time-axis limits are calculated as follows.

  • minimum time-axis limit = min(timedisplayoffset)

  • maximum time-axis limit = max(timedisplayoffset) timespan

tunable: yes

dependencies

to use this property, set framebasedprocessing to false, or set framebasedprocessing to true and timespansource to 'property'.

scope window use

open the configuration properties. on the time tab, set time span.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

specify how the scope displays new data beyond the visible time span.

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

tunable: yes

scope window use

open the configuration properties. on the time tab, set time span overrun action.

data types: char | string

specify the source of the time span for frame-based input signals as:

  • 'property' – the object derives the x-axis limits from the timedisplayoffset and timespan properties.

  • 'auto' – the time-axis limits are derived from the timedisplayoffset and samplerate properties and the framesize (number of rows in each input signal). the limits are calculated as:

    • minimum time-axis limit = min(timedisplayoffset)

    • maximum time-axis limit = max(timedisplayoffset) max(1/samplerate.*framesize)

tunable: yes

dependencies

to use this property, set framebasedprocessing to true.

scope window use

open the configuration properties. on the time tab, set time span.

data types: char | string

specify when the scope scales the axes. valid values are:

  • "auto" — the scope scales the axes as needed to fit the data, both during and after simulation.

  • "manual" — the scope does not scale the axes automatically.

  • "onceatstop" — the scope scales the axes when the simulation stops.

  • "updates" — the scope scales the axes once and only once after 10 updates.

scope window use

select tools > axes scaling.

data types: char | string

advanced

specify the name of the scope as a character vector or string scalar. this name appears as the title of the scope's figure window. to specify a title of a scope plot, use the title property.

tunable: yes

data types: char | string

scope window position in pixels, specified by the size and location of the scope window as a 4-element 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.

by default, the window appears in the center of your screen with a width of 410 pixels and height of 300 pixels. the exact position value depends on your screen resolution.

tunable: yes

  • true — the scope logs data for later use and updates the window periodically.

  • false — the scope updates every time the scope is called.

the simulation speed is faster when this property is set to true.

tunable: yes

scope window use

select simulation > reduce updates to improve performance.

specify the layout grid dimensions as a 2-element vector: [numberofrows,numberofcolumns]. you can use up to 16 rows and 16 columns.

example: scope.layoutdimensions = [2,4]

tunable: yes

scope window use

select view > layout.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

specify the type of plot to use.

  • line — line graph, similar to the or function.

  • stairs — stair-step graph, similar to the function. stair-step graphs are useful for drawing time history graphs of digitally sampled data.

tunable: yes

scope window use

open the style properties. set plot type.

data types: char | string

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 (10 x 100 x 10) as the buffer length.

scope window use

open the data history properties. set buffer length.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

  • true — enable frame-based processing.

  • false — enable sample-based processing.

scope window use

open the configuration properties. on the main tab, set input processing.

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.

tunable: yes

scope window use

open the configuration properties. on the time tab, set time units.

data types: char | string

specify, in seconds, how far to move the data on x-axis. the signal value does not change, only the displayed x-axis.

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.

tunable: yes

scope window use

open the configuration properties. on the time tab, set time display offset.

specify how time-axis labels should appear in the scope displays as:

  • 'all' — time-axis labels appear in all displays.

  • 'bottom' — time-axis labels appear in the bottom display of each column.

  • 'none' — no labels appear in any display.

tunable: yes

scope window use

open the configuration properties. on the time tab, set time-axis labels.

data types: char | string

specify whether to display the scope in maximized-axes mode. in this mode, the axes are 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" — 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" — the axes appear maximized in all displays. any values entered into the title and ylabel properties are hidden.

  • "off" — none of the axes appear maximized.

tunable: yes

scope window use

open the configuration properties. on the main tab, set maximize axes.

data types: char | string

display

specify the active display, by integer display number, 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: yes

scope window use

open the configuration properties. on the display tab, set active display.

display title, specified as a character vector or a string scalar.

tunable: yes

scope window use

click the analyzer tab on the spectrum analyzer toolstrip. in the configuration section, click settings. in the spectrum analyzer settings window that opens up, under display and labels, enter title.

data types: char | string

flag to show the legend, specified as true or false. to show a legend with the input names, set this property to true.

use the legend to control which signals are visible. in the scope legend, click a signal name to hide the signal in the scope. to show the signal, click the signal name again. to show only one signal, right-click the signal name. to show all signals, press esc.

tunable: yes

dependencies

to enable this property, set the viewtype property to "spectrum" or "spectrum and spectrogram".

scope window use

click the analyzer tab on the spectrum analyzer toolstrip. to see the legend, click legend in the configuration section.

to enable the legend, select spectrum in the analyzer tab.

data types: logical

when you set this property to true, the scope displays the time-axis label. when you set this property to false, the scope does not display the time-axis label, but still displays tick marks and other time-axis items. this property applies only if the timeaxislabels property is all or bottom.

tunable: yes

dependency

to control which display's axis is labeled, use the activedisplay property.

scope window use

open the configuration properties. on the time tab, set show time-axis label.

channel names in the input data, specified as a cell array of character vectors or an array of strings. the names you specify in this property appear in the following locations:

  • legend

  • spectrum analyzer settings > color and styling section

  • measurements and channel measurements tabs

if you do not specify channel names, the spectrum analyzer names the channels as channel 1, channel 2, and so on.

tunable: yes

dependency

to see the channel names, set showlegend to true.

scope window use

click the analyzer tab on the spectrum analyzer toolstrip. to see the legend, click legend in the configuration section.

data types: char

set this property to true to show gridlines on the plot.

tunable: yes

scope window use

open the configuration properties. on the display tab, set show grid.

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 useful for complex-valued input signals. turning on this property 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.

tunable: yes

scope window use

open the configuration properties. on the display tab, select plot signals as magnitude and phase.

specify the y-axis limits as a two-element numeric vector, [ymin, ymax].

if plotasmagnitudephase is false, the default is [-10,10]. if plotasmagnitudephase is true, the default is [0,10].

tunable: yes

dependencies

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

scope window use

open the configuration properties. on the display tab, set y-limits (minimum) and y-limits (maximum).

specify the text for the scope to display to the left of the y-axis.

tunable: yes

dependencies

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.

scope window use

open the configuration properties. on the display tab, set y-label.

data types: char | string

usage

description

scope(signal) displays the signal, signal, in the time scope display.

scope(signal,signal2,...,signaln) displays the signals signal, signal2,...,signaln in the time scope display when you set the numinputports property to n. in this case, signal1, signal2,...,signaln can have different data types and dimensions.

input arguments

specify one or more input signals to visualize in the dsp.timescope. signals can have different data types and dimensions.

example: scope(signal1,signal2)

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

object functions

to use an object function, specify the system object as the first input argument. for example, to release system resources of a system object named obj, use this syntax:

release(obj)
display scope window
hide scope window
determine visibility of scope
run system object algorithm
release resources and allow changes to system object property values and input characteristics
reset internal states of system object

if you want to restart the simulation from the beginning, call reset to clear the scope window displays. do not call reset after calling release.

examples

create dsp.sinewave and dsp.timescope objects. run the scope to display the signal

sine = dsp.sinewave('frequency',100,'samplerate',1000);
sine.samplesperframe = 10;
scope = dsp.timescope('samplerate',sine.samplerate,'timespan',0.1);
for ii = 1:10
     x = sine();
     scope(x);
end

run the release method to allow changes to property values and input characteristics. the scope automatically scales the axes.

release(scope)

tips

  • to close the scope window and clear its associated data, use the matlab® function.

  • to hide or show the scope window, use the and functions.

  • use the matlab mcc function to compile code containing a scope.

    you cannot open scope configuration dialogs if you have more than one compiled component in your application.

extended capabilities

version history

introduced in r2011a

see also

objects

objects

  • | |

blocks

topics

    网站地图