%Comparison of transfer functions and step responses
%   kja 070810
%   Generate systems
aminit;

s1=tf([1 0],[1 1 1]);s2=tf(1,[1 1]);s3=tf([-1.5 1],[1 2 1]);
s4=tf(1,[1 10]);s5=tf(10,[1 10]);s6=tf(1,[1 4 6 4 1]); 
s7=tf(1,[1 0.3 1]);s8=s6*s6;s9=tf(1,[1 1 1]);

%   Generate step responses
[y1,t1]=step(s1);[y2,t2]=step(s2);[y3,t3]=step(s3);
[y4,t4]=step(s4);[y5,t5]=step(s5);[y6,t6]=step(s6);
[y7,t7]=step(s7);[y8,t8]=step(s8);[y9,t9]=step(s9);

%   Plot results
subplot(331);pl=plot(t8,y8);title('a');ylabel('y');
set(pl,'Linewidth',AM_data_linewidth);axis([0 30 0 1.2]);
subplot(332);pl=plot(t4,y4);title('b');
set(gca,'Xtick',[0 0.2 0.4 0.6]);
set(pl,'Linewidth',AM_data_linewidth);axis([0 0.6 0 0.12]);
subplot(333);pl=plot(t3,y3);title('c');
set(pl,'Linewidth',AM_data_linewidth);axis([0 10 -0.5 1.2]);
subplot(334);pl=plot(t2,y2);title('d');ylabel('y');
set(gca,'Xtick',[0 2 4 6]);
set(pl,'Linewidth',AM_data_linewidth);axis([0 6 0 1.2]);
subplot(335);pl=plot(t9,y9);title('b');
set(pl,'Linewidth',AM_data_linewidth);axis([0 10 0 1.2]);
subplot(336);pl=plot(t7,y7);title('c');
set(pl,'Linewidth',AM_data_linewidth);axis([0 40 0 2]);
set(gca,'Xtick',[0 20 40 60]);
subplot(337);pl=plot(t1,y1);title('d');ylabel('y');xlabel('t');
set(pl,'Linewidth',AM_data_linewidth);axis([0 10 -0.2 1]);
subplot(338);pl=plot(t5,y5);title('d');ylabel('y');xlabel('t');
set(gca,'Xtick',[0 0.2 0.4 0.6]);
set(pl,'Linewidth',AM_data_linewidth);axis([0 0.6 0 1.2]);
subplot(339);pl=plot(t6,y6);title('d');ylabel('y');xlabel('t');
set(pl,'Linewidth',AM_data_linewidth);axis([0 15 0 1.2]);

amprint('comp-trf-stepresp.eps');
