Main Content

plot

(To be removed) Plot pulse signal and metrics

dsp.PulseMetrics and dsp.TransitionMetrics objects will be removed in a future release. Use the functions from Pulse and Transition Metrics instead. To plot the metrics, call the functions with no output arguments. For more information, see Compatibility Considerations.

Syntax

Description

example

plot(pm) plots the signal and metrics resulting from the last call of the object algorithm.

By default plot displays:

  • the low- and high-state levels and the state-level boundaries defined by the PercentStateLevelTolerance property.

  • the lower-, middle-, and upper-reference levels.

  • the locations of the mid-reference level crossings of the positive (+) and negative (-) transitions of each detected pulse.

When the TransitionOutputPort property of the object is set to true, the locations of the upper and lower crossings are also plotted. When the PreshootOutputPort or PostShootOutputPort properties are set to true, the corresponding overshoots and undershoots are plotted as inverted or noninverted triangles. When the SettlingOutputPort property is set to true, the locations where the signal enters and remains within the lower- and upper-state boundaries over the specified seek duration are plotted.

Examples

collapse all

Find the slew rates of the leading and trailing edges of a 2.3 V digital clock sampled at 4 MHz.

 load('pulseex.mat','x','t');

Construct the dsp.PulseMetrics object. Set the TransitionOutputPort property to true to report transition metrics for the initial and final transitions. Set the StateLevelsSource property to 'Auto' to estimate the state levels from the data.

 pm = dsp.PulseMetrics('SampleRate',4e6, ...
                            'TransitionOutputPort', true, ...
                            'StateLevelsSource','Auto');

Compute the pulse and transition metrics and plot the result.

 [pulse,transition] = pm(x); 
 plot(pm);

Input Arguments

collapse all

Signal and metrics object, specified as one of the following:

Version History

Introduced in R2012a

collapse all

R2021b: dsp.PulseMetrics and dsp.TransitionMetrics System objects will be removed

dsp.PulseMetrics and dsp.TransitionMetrics System objects will be removed in a future release. Use the functions from Pulse and Transition Metrics instead. To plot the metrics, call these functions with no output arguments.

Update Code

This table shows typical usage of the System object™ and explains how to update existing code to use these functions.

Discouraged UsageRecommended Replacement
load('clockex.mat','x','t');
pm = dsp.PulseMetrics('SampleRate',4e6,...
                       'TransitionOutputPort',true,...
                       'StateLevelsSource','Auto',...
                       'CycleOutputPort', true);
[pulse, cycle, transition] = step(pm,x)
pulse = 

  struct with fields:

    PositiveCross: [4×1 double]
    NegativeCross: [4×1 double]
            Width: [4×1 double]
         RiseTime: [4×1 double]
         FallTime: [4×1 double]

cycle = 

  struct with fields:

        Period: [4×1 double]
     Frequency: [4×1 double]
    Separation: [4×1 double]
         Width: [4×1 double]
     DutyCycle: [4×1 double]
transition = 

  struct with fields:

       Duration: [4×2 double]
       Polarity: [4×2 double]
       SlewRate: [4×2 double]
    MiddleCross: [4×2 double]
     LowerCross: [4×2 double]
     UpperCross: [4×2 double]

If you are using a release prior to R2016b, replace pm(x) with step(pm,x).

MATLAB® code using the replacement functions is shown below.

Plot the pulse

plot(pm)

Plot the pulse

To plot the individual pulse metrics, call the metrics functions without an output argument.

Some examples below:

dutycycle(x,t)
midcross(x,t)
pulseperiod(x,t)
pulsesep(x,t)
pulsewidth(x,t)