How to draw this figure ?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!