%Figure 2.5 (explained in Example 2.1 and Example 2.2)

% Plant (2.26), G(s)=3(-2s+1)/(5s+1)(10s+1)
Eq2_26

Kc=0.5;
gc=mmult(g,Kc);
s = minv(madd(1,gc));
t = msub(1,s);
u=1;
y1 = trsp(t,u,50);

Kc=1.5;
gc=mmult(g,Kc);
s = minv(madd(1,gc));
t = msub(1,s);
u=1;
y2 = trsp(t,u,50);

Kc=2.5;
gc=mmult(g,Kc);
s = minv(madd(1,gc));
t = msub(1,s);
u=1;
y3 = trsp(t,u,50);

Kc=3;
gc=mmult(g,Kc);
s = minv(madd(1,gc));
t = msub(1,s);
u=1;
y4 = trsp(t,u,50);

line1=[-0.26 32.5;-0.26 47; 2 Inf];
line2=[-0.26 32.5;-0.23 33.5; 2 Inf];
line3=[-0.26 32.5;-0.29 33.5; 2 Inf];
line4=[-0.26 47;-0.23 46; 2 Inf];
line5=[-0.26 47;-0.29 46; 2 Inf];

subplot(111),vplot(y1,y2,y3,y4,':',1,':',line1,line2,line3,line4,line5)
axis([0 50 -0.5 2.5]);
text(11,1.95,'Kc=2.5'); text(14,1.3,'Kc=1.5'); text(8,0.2,'Kc=0.5');
text(10,2.35,'Kc=3 (Unstable)');
text(40,-0.15,'Pu');
xlabel('Time');ylabel('y');
