% Tony Hyun Kim

% 6.302 PS3, Problem 7



% wn    dr (damping ratio)

data =[5    0.1;

       5    0.3;

       5    0.5;

       5    1/sqrt(2);

       5    0.6;

       2    0.5;

       10   0.5;

       20   0.5;

       30   0.5;

       45   0.5;

       12.5     0.2;

       6.25     0.4;

       2.5/.6   0.6;

       2.5/.7   0.7;

       2.5/.5   0.5];



data = sortrows(data,2);



% dr vs. magnitude peaking

subplot(311);

dr = data(:,2);

mp = 1./(2*dr.*sqrt(1-dr.^2));

plot(dr,mp,'o','markersize',3); hold on;

plot(dr,mp);

xlabel('Damping ratio, \zeta');

ylabel('Magnitude peaking, M_p');

ylim([0 6]);

title('\zeta vs. Magnitude peaking. Valid only for \zeta < 0.707');

grid on;



% magnitude peaking vs. peak overshoot

po = 1 + exp(-pi*dr./sqrt(1-dr.^2));

subplot(312);

plot(mp,po,'o','markersize',3); hold on;

plot(mp,po);

ylim([0 2]);

xlabel('Magnitude peaking, M_p');

ylabel('Peak overshoot, P_0');

title('Magnitude peaking vs. peak overshoot');

grid on;



% rise time vs. bandwidth

wn = data(:,1);

wh = wn.*sqrt(1-2*dr.^2+sqrt(2-4*dr.^2+4*dr.^4));

rt = 2.2./wh;

subplot(313);

plot(rt,wh,'o','markersize',3);

xlabel('Rise time, t_r');

ylabel('Bandwidth, \omega_h');

grid on;