%Tan Nguyen, Trang Pham, Nhan Phan
%ECE 460 Lab
%WINTER 2003
%Lab #2
%Part C (d)
clear;
clc;
t=[0:0.01:80];
b=[0.2,0.4,0.6,0.8,1,2,5,10,20]';
p=[0.08,0.16,0.24,0.32,0.4,0.8,2,4,8];
figure(1)
for i=1:9
    num=[p(i)];
    den=[1 (0.8+p(i)) (1+0.8*p(i)) p(i)];
    sys=tf(num,den);
    ys=step(sys,t);
    hold on
    plot(t,ys)
    xlabel('t axis')
    ylabel('ys axis')
    title('Part C (d): Step response of the Normalized Second Order System with an Added Pole')
    grid on
    [tp(i),os(i),ts(i)]=tposts(t,ys)
end

hold off
figure(2)
subplot(3,1,1)
plot(b,tp)
title('Peak time');
grid on

subplot(3,1,2);
plot(b,os)
title('Settling Time');
grid on

subplot(3,1,3);
plot(b,ts);
title('Settling Time');
grid on


