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 CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by