Plotting System Responses to Specified Inputs Using MATLAB

Plotting System Responses to Specified Inputs Using MATLAB

Typically, the test signals for input systems include step functions, ramp functions, acceleration functions, and sine functions, but a custom function can also be specified. num1=[1 2];den1=[2 3 4];t1=0:0.01:10;% step response y1=step(num1,den1,t1);figure(1),plot(t1,y1);% ramp response x2=t1;y2=lsim(num1,den1,x2,t1);figure(2),plot(t1,y2);% acceleration response x3=0.5*t1.*t1;y3=lsim(num1,den1,x3,t1);figure(3),plot(t1,y3);% sine response x4=sin(2*pi*5.*t1);y4=lsim(num1,den1,x4,t1);figure(4),plot(t1,y4);% exponential response x5=exp(0.5*t1);y5=lsim(num1,den1,x5,t1);figure(5),plot(t1,y5);