Wednesday, November 9, 2011

10/90 rise time, 2% settling time, peak overshoot--matlab

zeta = \sqrt(0.5);
Ts = 0.5;
wn = 4/(zeta * Ts);
% create a transfer function with the required poles.
Gs = tf(wnˆ2,[1 2 * zeta * wn wnˆ2]);
% Create discrete time transfer function at T = 0.2 seconds sampling.
T = 0.1;
Gz = c2d(Gs,T);
% and compute its step response.
[y,t] = step(Gz,5);
figure(1);
clf;
stairs(t,y,’k’);
set(gca,’fontsize’,12,’ylim’,[0 1.1]);
title(’Step Response of Discrete Time System’);
% 10/90 Rise time
t10 = t(max(find(y<0.1))) +T;
t90 = t(max(find(y<0.9))) +T;
% Note 1 sample is added to each time, since the transitions happen
% somewhere between the last sample below 10 or 90% (which is what the
% command is finding) and the next sample.
% This is somewhat arbitrary, one could argue that the 10/90 rise time is
% one sample longer (from the last sample below 10% to the first sample
% above 90%).
Tr1 = t90-t10;
% 2% settling time
err = abs(y - 1);
Ts = t(max(find(err>0.02)))+T;
% again, one sample is added, since the find command finds the last
% sample before the system settles inside the 2% bounds.
% Peak Overshoot
[ymax, tmax] = max(y);
PO = 100 * (ymax-1);
which computes
Tr1 = 0.2 sec
P O = 4.31%
Ts = 0.6 sec

No comments:

Post a Comment