%% Transition, Postshoot, and Settling Information of a 2.3 V Step Waveform
% Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes  step(obj,x).
% Compute transition, postshoot, and settling information of a 2.3 V step waveform sampled at 4 MHz. Load the data along with the sampling instants.

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

%
% Construct the dsp.TransitionMetrics object. Set the TimeInputPort property to true, StateLevels property to [0 2.3] to match waveform statelevels. To output the postshoot information and settling information, set the PostShootOutputPort and  SettlingOutputPort properties to true. Set the SettlingSeekDuration property to 2 ms.

tm = dsp.TransitionMetrics('TimeInputPort',true, ...
                                 'StateLevels',[0 2.3], ...
                                 'PostshootOutputPort',true, ...
                                 'SettlingOutputPort',true, ...
                                 'SettlingSeekDuration',2e-6)

%
% Compute the transition, postshoot, and settling information and plot the result.

 [transition,postshoot,settling] = tm(x,t) 
 plot(tm)

% Copyright 2012 The MathWorks, Inc.