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 日間)
Mirza Vikhar Ali Baig
Mirza Vikhar Ali Baig 2018 年 3 月 15 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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