Program in Scilab:
s=%s;
g=4/(s*(s+2));
gc=4.68*(s+2.9)/(s+5.4);
gs=syslin('c',g);
glc=g/. 1;
gt=gc*g;
gtlc=gt/. 1;
t=0:0.05:5;
glcs=syslin('c',glc);
gtlcs=syslin('c',gtlc);
gts=syslin('c',gt);
//root-locus
clf;
subplot(2,1,1)
evans(gs);
xgrid;
xtitle('no compensated system')
subplot(2,1,2)
evans(gts);
xtitle('compensated system')
xgrid;
//respons to step
clf;
y=csim('step',t,glcs);
yt=csim('step',t,gtlcs);
//root locus
plot(t,y);
plot(t,yt,'g');
xgrid;
legend(['no compensated';'compensated'],style=4);
xtitle('response to step')
|
|