How to use the generated LQG controller
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponses (1)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!