%% Lower and Upper Reference Levels
% Return the waveform values corresponding to the lower- and upper-reference levels for a three-transition waveform sampled at 4 MHz. Compute these values for 10% and 90%, the default levels.

load('transitionex.mat','x')
fs = 4e6;

y = [x;fliplr(x)];
t = (0:length(y)-1)/fs;

[~,~,~,LL,UL] = slewrate(y,t)

%
% Repeat the calculation for 20% and 80%. Annotate the result on a plot of the waveform

slewrate(y,t,'PercentReferenceLevels',[20 80]);

% Copyright 2015 The MathWorks, Inc.