How to draw this figure ?

1 回表示 (過去 30 日間)
Alan Robertson
Alan Robertson 2020 年 3 月 5 日
Hello !
How can I draw this figure so that y(i) follows it?
This is the figure :
And this is the code to modify ( i think "ref") :
clear, clc
Ac=[0 1;0 0]; Bc=[0;1]; Cc=[1 0]; Dc=0;
[A,B,C,D]=c2dm(Ac,Bc,Cc,Dc,0.1)
ref=5;
N=600;
Q=[1 2;2 1] ; R=0.1;
P=Q;
x_ref=[ref;0];
for k=N:-1:0
F=R+B'*P*B;
K=inv(F)*B'*P*A;
M=P-P*B*inv(F)*B'*P;
P=A'*M*A+Q;
end
u=0 ; x=[0;0];
for i=1:N
x=A*x+B*u;
u=-K*(x-x_ref);
y(i)=C*x;
end
plot(1:N,ref*ones(1,N),'r',1:N,y)

回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by