%Niveen Bazaraa
%ECE 460 Control Systems
%Lab 3
%Tuesday 23 Sept 2003
%File name  Lab3C_a_b

clear all
home
t=[0:0.01:60]';
z=[.15:.05:1];

for i = 1 : 18;            % This loop shows how increasing damping ratio causes the output signal
    num=1;                 % to have less ocillations about the steady state
    den=[1 2*z(i) 1];
    sys=tf(num,den);
    ys=step(sys,t);
    [tp(i), os(i), ts(i) ] = tposts(t,ys);
    plot(t,ys)
    pause
end

for i = 1 : 18;             % This loop shows the same thing but plots them all on a single plot
    num=1;
    den=[1 2*z(i) 1];
    sys=tf(num,den);
    ys=step(sys,t);
    [tp(i), os(i), ts(i) ] = tposts(t,ys);
    plot(t,ys)
    pause
    hold on
end

xlabel('The t axis')
ylabel('The y axis')
title('The normalized unit step response')
grid on
pause


subplot(3,1,1)
plot(z,tp);
xlabel('The damping axis')
ylabel('The peak time axis')
title('Peak time vs Damping Ratio')
grid on

subplot(3,1,2)
plot(z,os);
xlabel('The damping axis')
ylabel('The overshoot axis')
title('Overshoot vs Damping Ratio')
grid on

subplot(3,1,3)
plot(z,ts);
xlabel('The damping axis')
ylabel('The settling time axis')
title('Settling time vs Damping Ratio')
grid on
