Info

此问题已关闭。 请重新打开它进行编辑或回答。

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 次查看(过去 30 天)
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');

回答(1 个)

Prajit T R
Prajit T R 2018-3-20
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

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by