Page 849 - Mechatronics with Experiments
P. 849
®
®
MATLAB , SIMULINK , STATEFLOW, AND AUTO-CODE GENERATION 835
FIGURE A.9: Simulation results of a second-order system for impulse, step, and a
®
user-defined input functions using the MATLAB functions impulse, step,and lsim.
num=[wnˆ2];
den=[1 2∗psi∗wn wnˆ2];
sys1=tf(num,den);
% Impulse response
t=[0:0.01:4.0];
figure(1);
impulse(sys1,t);
% Step response
t=[0:0.01:4.0];
figure(2);
step(sys1,t)
% Response to a general input
t=[0:0.01:4.0];
u= 1.0 ∗ sin(2∗pi∗t);
figure(3);
lsim(sys1,u,t) ;
®
MATLAB provides the following functions for the numerical solution of nonlinear
differential equations.