next up previous
Next: Interconnection Up: Dynamical systems Previous: Definition

Simulation

-->sl=syslin('c',1/(s*s+0.2*s+1))
 sl  =
         1
    -----------
                2
    1 + 0.2s + s
-->instants=0:0.05:20;
-->//             step response:
-->y=csim('step',instants,sl);
-->plot2d(instants',y')
\fbox{\epsfig{file=foo0_1.eps,width=3.75in}}
-->//             Delayed step response
-->deff('[in]=u(t)','if t<3 then in=0;else in=1;end');
-->y1=csim(u,instants,sl);plot2d(instants',y1');
-->//             Impulse response;
-->yi=csim('imp',instants,sl);;plot2d(instants',yi');
\fbox{\epsfig{file=foo0_2.eps,width=3.75in}}
-->yi1=csim('step',instants,s*sl);plot2d(instants',yi1');
-->//              Discretization
-->dt=0.05;
-->sld=dscr(tf2ss(sl),0.05);
-->//               Step response
-->u=ones(instants);

-->yyy=flts(u,sld);
-->;plot(instants,yyy)
\fbox{\epsfig{file=foo0_3.eps,width=3.75in}}
-->//              Impulse response
-->u=0*ones(instants);u(1)=1/dt;
-->yy=flts(u,sld);
-->;plot(instants,yy)
\fbox{\epsfig{file=foo0_4.eps,width=3.75in}}



Scilab group