matlab Time domain signal display

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:

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

  2. 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 PropertyNamePropertyValue 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.

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

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

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

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

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

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

This property is Tunable.

Default: 'All'

TimeDisplayOffset

Time display offset

Specify the offset, in seconds, to apply to the 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.

Minimum x-axis limit = min(TimeDisplayOffset)
Maximum x-axis limit = max(TimeDisplayOffset)+ TimeSpan

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

  • When you set this property to Wrap,the Time Scope displays new data up until it reaches the maximum x-axislimit. When the data reaches the maximum x-axislimit of the Time Scope window, the Time Scope clears the display.The Time Scope then updates the time offset value and begins displayingsubsequent data points starting from the minimum x-axislimit.

  • When you set this property to Scroll,the Time Scope scrolls old data to the left to make room for new dataon the right side of the Time Scope display. This mode is graphicallyintensive and can affect run-time performance, but it is beneficialfor debugging and for monitoring time-varying signals.

This property is Tunable.

Default: 'Wrap'

TimeSpanSource

Source of time span

Specify the source of the time span for frame-based input 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:

Minimum x-axis limit = min(TimeDisplayOffset)
Maximum x-axis limit = max(TimeDisplayOffset)+ max(1/SampleRate.*FrameSize)

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.

  • When you set this property to 'Metric',the Time Scope converts the time axis values to the most appropriatemetric units, such as microseconds, milliseconds, minutes, days, etc.

  • When you set this property to 'Seconds',the Time Scope will always leave the time units as seconds.

  • When you set this property to 'None',the Time Scope will not display any units on 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

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

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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值