Use MATLAB to plot a response of a closed-loop system to a step input or unit ramp?
Im not sure if I can ask such question here, since this has to do with control and design..
Anyway, im trying to plot a response of closed-lo开发者_开发百科op system to a unit ramp and step input using matlab, but im not sure how to get this done ..
My transfer function is : G= 13/(s*(s+3)*(s+1)) and K=8
Any ideas ?
thanks !
The control system toolbox is even more convenient than Alejandro has led you to believe!
s = tf('s');
K = 8;
G = 13/(s*(s+3)*(s+1));
CL = G/(1+K*G);
step(CL); % step response
step(CL/s); % ramp response
Remember that the ramp response is the integral of the step response. Thus, you can multiply the step response by 1/s and you get the ramp.
Assuming you have the control system toolbox. Lets do it for G(s) = 1 / (s + 1) .
G = tf(1, [1 1]);
CL = feedback(G, 1);
step(CL) % Step response
t = 0:.01:5;
lsim(CL,t,t) % Ramp response
For your example, all you need to change is the defininition of G (help tf for the details), and maybe adjust the time vector t to the time range you want.
精彩评论