//www.basicairdata.eu 2013 (c) JLJ //Second order system step response plot and bode plot //Example figure s=poly(0,'s'); t=linspace(0,2,200); //Second order transfer function Natural frequency wn 10 1/s, damping psi 0.15 //Denominator is in the form S^2+2*psi*wn*S+wn^2 //Numerator is wn^2 to have unity dc gain //Natural frequency 10 1/s, damping 0.15 H1=(100)/(s^2+2*0.15*10*s+100); fdt=syslin('c',H1) y=csim('step',t,fdt); plot2d(t,y,1); xgrid(); //Natural frequency 10 1/s, damping 0.2 H1=(100)/(s^2+2*0.2*10*s+100); fdt=syslin('c',H1) y=csim('step',t,fdt); plot2d(t,y,2); //Natural frequency 10 1/s, damping 0.4 H1=(100)/(s^2+2*0.4*10*s+100); fdt=syslin('c',H1) y=csim('step',t,fdt); plot2d(t,y,3); //Natural frequency 10 1/s, damping 0.8 H1=(100)/(s^2+2*0.8*10*s+100); fdt=syslin('c',H1) y=csim('step',t,fdt); plot2d(t,y,4); xlabel("Time [s]") ylabel("Step response") xtitle("Second order system response to a unity step at t=0 s www.basicairdata.eu JLJ") f1=figure(); f1.background=8; //Now some wn value //Natural frequency 10 1/s, damping 0.8 H1=(100)/(s^2+2*0.8*10*s+100); fdt=syslin('c',H1) y=csim('step',t,fdt); plot2d(t,y,1); xgrid(); //Natural frequency 20 1/s, damping 0.8 H1=(400)/(s^2+2*0.8*20*s+400); fdt=syslin('c',H1) y=csim('step',t,fdt); plot2d(t,y,2); //Natural frequency 100 1/s, damping 0.8 H1=(10000)/(s^2+2*0.8*100*s+10000); fdt=syslin('c',H1) y=csim('step',t,fdt); plot2d(t,y,3); xlabel("Time [s]") ylabel("Step response") xtitle("Second order system response to a unity step at t=0 s www.basicairdata.eu JLJ")