How to use the generated LQG controller

7 vues (au cours des 30 derniers jours)
RV_S
RV_S le 11 Oct 2019
Commenté : RV_S le 12 Oct 2019
I have a finite-horizon discrete-time system given by
to be regulated around a setpoint r
I provided the matrices A, B, C, D = 0, QXU, QVW, QI and created a controller KLQG. For the purposes of this problem, y and r are scalars (1x1). dim(u) = dim(x) = 50. v and w are white Gaussian noise.
I believe the controller takes [y;r] as input and provides u as an output. However, I'm unsure on how to call this function and how to implement this in the overall system. Also noticed that the A,B,C,D matrices inside KLQG are different from the ones I supplied. I'm following this Mathworks page.
sys = ss(A,B,C,D,1) %D = 0, discrete-time
KLQG = lqg(sys,QXU,QWV,QI); %Create LQG
for n = 1:99 %100 time steps, assume x is initialized, i.e. x(:,1) is given
y = C*X(:,n) + wnoise(); %wnoise() generates white gaussian noise of length dim(y)
u(:,n) = f(r,y); %Tried KLQG([r;y]) but doesn't work, what is f?
X(:,n+1) = A*X(:,n) + B*u(:,n) + vnoise(); %vnoise() generates white gaussian noise of length dim(x)
end
y(:,100) = C*X(:,100) + wnoise(); %Hopefully this is close to setpoint r
J = 0;
for n = 1:100 %Compute cost
J = J + [x(:,n)' u(:,n)']*QXU*[x(:,n); u(:,n)] + xi(:,n)'*QI*xi(:,n);
end
Ideally since this is a discrete time problem, I'd like my cost function to be a little different with the final state being taken into account like the problem setup here but we can ignore that for now.
TLDR; How to compute xi and u?

Réponses (1)

test
test le 11 Oct 2019
te this is my first app on this app and first comment.

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by