dsp.TimeScope System object - Package: dsp
Time domain signal display
Description
The TimeScope object displays time-domainsignals.
To display time-domain signals in the Time Scope:
-
Define and set up your Time Scope. See Construction.
-
Call step to display the signal inthe Time Scope figure. The behavior of step is specificto each object in the toolbox.
Use the MATLAB clear function to closethe Time Scope figure window.
-
Note For information about the graphical user interface of the TimeScope, see Time Scope.
Construction
H = dsp.TimeScope returnsa Time Scope System object, H. This object displaysreal- and complex-valued floating and fixed-point signals in the timedomain.
H = dsp.TimeScope('PropertyName',PropertyValue,...) createsa Time Scope System object, H, with each specifiedproperty PropertyName set to the specifiedvalue.
H = dsp.TimeScope(NUMINPUTS,SAMPLERATE,'PropertyName',PropertyValue,...) createsa Time Scope System object, H. This object has the NumInputPorts property set to NUMINPUTS,the SampleRate property set to SAMPLERATE,and other specified properties set to the specified values. NUMINPUTS and SAMPLERATE arevalue-only arguments. You can specify PropertyName–PropertyValue argumentsin any order.
Properties
ActiveDisplay | Active display for display-specific properties Specify as an integer the active display number for gettingand setting relevant properties. The number of a display correspondsto its column-wise placement index. Setting this property controlswhich display is used for YLimits, YLabel, LegendSource, Grid, Title,and MagnitudePhase. This property is Tunable. Default: 1 | ||
FrameBasedProcessing | Process input in frames or as samples When you set this property to true, you enableframe-based processing. When you set this property to false,you enable sample-based processing. This property is Tunable. Default: true | ||
Grid | Option to enable or disable grid display When you set this property to true, the gridappears. When you set this property to false, thegrid does not appear. When set, ActiveDisplay controlswhich display is updated. This property is Tunable. Default: false | ||
LayoutDimensions | Layout grid dimensions Specify the layout grid dimensions as a 2-element vector: [numberOfRows,numberOfColumns]. You may use no more than four rows orfour columns. This property is Tunable. Default: [1,1] | ||
LegendSource | Source of legend Specify the source of the legend as either None or Auto.When you set this property to 'None', the TimeScope does not display a legend. When you set this property to 'Auto',the Time Scope displays a legend with automatic string labels foreach input channel. See FrameBasedProcessing forinformation on input channels. This property is Tunable. Default: 'None' | ||
MagnitudePhase | Set this property to true to plot the magnitude and phase ofthe input signal on two separate axes within the same active display.When set, ActiveDisplay controls which displaysare updated. The active display shows the magnitude of the input signalon the top axes and its phase, in degrees, on the bottom axes. This priperty is particularly useful for complex-valued inputsignals. When the input signal is real-valued and you select thischeck box, the phase will be 0 degrees when the amplitude of the inputsignal is nonnegative and 180 degrees when the input signal is negative.This property is Tunable. Default: false | ||
Name | Caption to display on Time Scope window Specify the caption to display on the scope window as any string.This property is Tunable. Default: 'Time Scope' | ||
NumInputPorts | Number of input signals Specify the number of input signals to display on the Time Scopeas a positive integer. You must invoke the step methodwith the same number of inputs as the value of this property. Default: 1 | ||
PlotType | Option to control the type of plot Specify the type of plot to use for all the input signals displayedin the Time Scope GUI.
This property is Tunable. Default: 'Line' | ||
Position | Time Scope window position in pixels Specify, in pixels, the size and location of the Time Scopewindow as a 4-element double vector of the form, [left bottomwidth height]. You can place the Time Scope window in aspecific position on your screen by modifying the values to this property.This property is Tunable. Default: The default depends on your screen resolution. By default,the Time Scope window is placed in the center of your screen witha width of 410 pixels and height of 300 pixels. | ||
SampleRate | Sample rate of inputs Specify the sampling rate, in hertz, of any input signal, asa scalar or as a numeric vector with length equal to the value of NumInputPorts.The inverse of the sample rate determines the spacing between pointson the x-axis (time axis) in the displayed signal.When you set SampleRate to a scalar value and NumInputPorts isgreater than 1, the object uses the same sample rate for all inputs. Default: 1 | ||
TimeAxisLabels | Time-axis labels Specify how time-axis labels should appear in the Time Scopedisplays as one of 'All', 'Bottom,or 'None'.
This property is Tunable. Default: 'All' | ||
TimeDisplayOffset | Time display offset Specify the offset, in seconds, to apply to the x-axis(time axis). This property can be either a numeric scalar or a vectorof length equal to the number of input channels. If you specify thisproperty as a scalar, then that value is the time display offset forall channels. If you specify a vector, each vector element is thetime offset for the corresponding channel. For vectors with lengthless than the number of input channels, the time display offsets forthe remaining channels are set to 0. If a vector has a length greaterthan the number of input channels, the extra vector elements are ignored.This property is Tunable. See FrameBasedProcessing forinformation on input channels. See TimeSpan and TimeSpanSource forinformation on the x-axis limits and time spansettings. Default: 0 | ||
TimeSpan | Specify the time span, in seconds, as a positive, numeric scalarvalue. This property applies when FrameBasedProcessing is false.This property also applies when FrameBasedProcessing is true and TimeSpanSource is Property.The x-axis limits are calculated as follows.
where TimeDisplayOffset and TimeSpan arethe values of their respective properties. This property is Tunable. Default: 10 | ||
TimeSpanOverrunMode | Wrap or scroll when the TimeSpan value is overrun Specify how the Time Scope displays new data beyond the visibletime span as one of 'Wrap' or 'Scroll'.
This property is Tunable. Default: 'Wrap' | ||
TimeSpanSource | Source of time span Specify the source of the time span for frame-based input signalsas one of 'Auto' or 'Property'.This property applies when FrameBasedProcessing isset to true. When you set this property to 'Property',the object derives the x-axis limits from the TimeDisplayOffset and TimeSpan properties.When you set this property to Auto, the x-axislimits are the following:
where TimeDisplayOffset and SampleRate arethe values of their respective properties. FrameSize is a vector equalto the number of rows in each input signal. This property is Tunable. Default: 'Property' | ||
TimeUnits | Units of the time axis Specify the units used to describe the time axis.
This property is Tunable. Default: 'Metric' | ||
Title | Display title Specify the display title as a string. When set, ActiveDisplay controlswhich display is updated. This property is Tunable. Default: '' | ||
YLabel | The label for the y-axis Specify the y-axis label as a string. Thisproperty applies only when MagnitudePhase is false.When MagnitudePhase is true, thetwo y-axis labels are read-only values that areset to 'Magnitude' and 'Phase' forthe magnitude plot and the phase plot, respectively. When set, ActiveDisplay controlswhich display is updated. This property is Tunable. Default: 'Amplitude' if MagnitudePhase is false | ||
YLimits | The limits for the y-axis Specify the y-axis limits as a 2-elementnumeric vector, [ymin ymax]. When set, ActiveDisplay controlswhich display is updated. When MagnitudePhase is true,this property specifies the y-axis limits of onlythe magnitude plot. The y-axis limits of the phaseplot are always [-180, 180]. This property is Tunable. Default: [-10, 10] if MagnitudePhase is false, [0,10] if MagnitudePhase is true. |
Methods
clone | Create time scope object with same property values |
getNumInputs | Number of expected inputs to step method |
getNumOutputs | Number of outputs of step method |
hide | Hide time scope window |
isLocked | Locked status for input attributes and nontunable properties |
release | Allow property value and input characteristics changes |
reset | Reset internal states of time scope object |
show | Make time scope window visible |
step | Display signal in time scope figure |
Examples
View a sine wave on the Time Scope window:
hsin = dsp.SineWave('Frequency',100, 'SampleRate', 1000); hsin.SamplesPerFrame = 10; hts1 = dsp.TimeScope('SampleRate', hsin.SampleRate,'TimeSpan', 0.1); for ii = 1:10 x = step(hsin); step(hts1, x); end
Run the release method to automaticallyscale the axes.
release(hts1);
Run the clear function to close the TimeScope window.
clear(hts1);
View two sine waves with different sample rates and time offsets.
Fs = 1000; % Sampling frequency hsin1 = dsp.SineWave('Frequency',50,... 'SampleRate',Fs, ... 'SamplesPerFrame', 100); % Create FIRDecimator System object to decimate by 2 hfilt = dsp.FIRDecimator; % Create TimeScope System object with 2 input % ports (channels) hts2 = dsp.TimeScope(2, [Fs Fs/2], ... 'TimeDisplayOffset', [0 38/Fs], ... 'TimeSpan', 0.25, ... 'YLimits',[-1 1], ... 'LegendSource', 'Auto'); for ii = 1:2 xsine = step(hsin1); xdec = step(hfilt,xsine); step(hts2, xsine, xdec); end
Run the release method to automaticallyscale the axes.
release(hts2);
Run the clear function to close the TimeScope window.
clear(hts2);
Algorithms
This object implements the algorithm, inputs, and outputs describedon the Time Scope block reference page.The object properties correspond to the block parameters.