Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

When I use impulse for two different ss the plot is just one..I need two plots when I get the response and then I want to super impose those two plots..How do I do it

1 view (last 30 days)
A=[0 1 0 0;0 0 -1 0;0 0 0 1;0 0 9 0]; B=[0;0.1;0;-0.1]; C=[0 0 1 0]; x0=[0.1;0;0.1;0]; C'*C %selectingQ based on the above matrix u=1; v=1; Q=[v 0 0 0;0 0 0 0;0 0 u 0;0 0 0 0]; R=0.1; [K,S,e]=lqr(A,B,Q,R) Ac=[(A-B*K)]; Bc=[B]; Cc=[C]; Dc=[0]; impulse(Ac,Bc,Cc,Dc,1,'r'); % from the graph the settling time is about 5sec R1=0.01; [K1,S1,e1]=lqr(Ac,Bc,Q,R1) Ac1=[(Ac-Bc*K1)]; Bc1=[Bc]; Cc1=[Cc]; Dc1=[0]; impulse(Ac1,Bc1,Cc1,Dc1,1,'g');

Answers (1)

Prajit T R
Prajit T R on 20 Mar 2018
Hi Mirza
Just use the 'hold on' command on the line above this one: impulse(Ac1,Bc1,Cc1,Dc1,1,'g'); 'hold on' will ensure that the first plot will not be overwritten, so you can see both the plots together in one figure.
Cheers

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!