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

clear all
home
t=[0:0.01:80]';
z=.4;
beta2=[.2 .4 .6 .8 1 2 5 10 20];
v=0.4.*beta2;

for i = 1 : 9;                        % This loop shows how increasing damping ratio causes the output signal
    num=[0 0 0 v(i)];                 % to have less ocillations about the steady state
    den=[1 .8+v(i) .8*v(i)+1 v(i)];
    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 : 9;            % This loop shows how increasing damping ratio causes the output signal
    num=[0 0 0 v(i)];                 % to have less ocillations about the steady state
    den=[1, .8+v(i), .8*v(i)+1, v(i)];
    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(beta2,tp);
xlabel('The beta2 axis')
ylabel('The peak time axis')
title('Peak time vs Beta2')
grid on

subplot(3,1,2)
plot(beta2,os);
xlabel('The beta2 axis')
ylabel('The overshoot axis')
title('Overshoot vs Beta2')
grid on

subplot(3,1,3)
plot(beta2,ts);
xlabel('The beta2 axis')
ylabel('The settling time axis')
title('Settling time vs Beta2')
grid on

beta2=beta2'
tp=tp'
os=os'
ts=ts'
