function ts=setltime(num,den)
%SETLTIME - Settling time of a continuous-time linear system.
%
[yc,xc,t]=step(num,den);
n=length(t);
yss=yc(n);
delt5=0.05*yss;
for i=1:n;
    ymax(i)=(1+delt5)*yss;
    ymin(i)=(1-delt5)*yss;
end;
while (abs(yc(n)-yss)<delt5);
    n=n-1;
end;
ts=t(n);
vert=[0 ymin(ts)];
t1=[ts ts];
hold off
plot(t,yc,'-',t,ymax,':',t,ymin,':')
hold on;
plot(t1,vert,':')
text(ts+0.1,0.1,'ts')
xlabel('t [sec]')
ylabel('y')
disp('Settling time (in [s]) of the system:')
printsys(num,den)
disp('is:')
