Problem with kalman function for LQG

I am trying to implement and LQG regulator, but for some reason I get an error related to the "kalman" function. A snippet of my code is as follows:
sys=ss(A_ae_control,[B_ae_control(:,1) B_ae_control(:,2)],C_ae_control,0);
Qn=0.7;
Rn=0.01*eye(size(A_ae_control,1));
kest=kalman(sys,Qn,Rn);
The variable B_ae_control has 2 columns, with the first column corresponding to the control input and the second column corresponding to the random noise input. The code seems to run when I set Qn to be a 2x2 matrix, but I don't see why this should be the case since I have only one noise input. I get the following error message when I run the above code:
The "kalman" command could not compute a convergent Kalman estimator for this plant model and
covariance data. To remedy the problem:
1. Make sure that all unstable poles of A are observable through C (use MINREAL to check)
2. Modify the weights QN and RN to make [G 0;H I]*[Qn Nn;Nn' Rn]*[G 0;H I]' positive definite (use EIG
to check positivity)
I have tried checking the observability and controllability of the system but I am not sure what else to do. Any insight would be appreciated!

11 comentarios

I think it should either be:
sys=ss(A_ae_control,B_ae_control(:,1),C_ae_control,0);
Qn=0.7;
Rn=0.01*eye(size(A_ae_control,1));
Qn_matrix = B_ae_control(:,2)*Qn*B_ae_control(:,2)'
kest=kalman(sys,Qn,Rn);
or
sys=ss(A_ae_control,[B_ae_control(:,1) B_ae_control(:,2)],C_ae_control,0);
Qn=0.7;
Rn=0.01*eye(size(A_ae_control,1));
Qn_matrix = [0,0;0,Qn]
kest=kalman(sys,Qn,Rn);
If you post your A,B and C matrices, then i can check
Arhant Sethia
Arhant Sethia el 20 de Mayo de 2020
Editada: Arhant Sethia el 20 de Mayo de 2020
Tried both methods and still no luck unfortunately. Please see attached my A, B and C matrix. Appreciate your help!
Arhant Sethia
Arhant Sethia el 20 de Mayo de 2020
The problem seems to be with the column of B corresponding to the noise input. For example, it works when I define this as a column of all ones. Any idea why this could be the case?
William Alberg
William Alberg el 20 de Mayo de 2020
Editada: William Alberg el 20 de Mayo de 2020
The following appears to work:
Qn = 0.7;
Rn = 0.01*eye(16);
sys = ss(A,B,C,0);
[kest,L,P] = kalman(sys,Qn,Rn)
"kalman" allows for specification on which column of B that is controlled
sys = ss(A,B,C,0);
[kest,L,P] = kalman(sys,Qn,Rn,0,1:16,1);
"1:16" is related to the sensors - Essentielly stating that all sensors are measureing (atleast if i understand correctly)
"1" is related to input, and states that column 1 is known. column 2 is then treated as unknown
Arhant Sethia
Arhant Sethia el 20 de Mayo de 2020
What did you set as Qn and Rn? For some reason I still get the convergence error when I run it. Just to clarify did you use the whole B matrix that I sent or just the first column? Thanks
I edited my previus response some time after i posted it to include the Qn and Rn, i guess you didn't see it
The B matrix is both columns.
My complete test code is below:
clc;clear;close all
A = load('A_ae_control');
A = A.A_ae_control;
B = load('B_ae_control');
B = B.B_ae_control;
C = load('C_ae_control');
C = C.C_ae_control;
D = 0;
Qn = 0.7;
Rn = 0.01*eye(16);
sys = ss(A,B,C,0);
[kest,L,P] = kalman(sys,Qn,Rn,0,1:16,1);
Arhant Sethia
Arhant Sethia el 20 de Mayo de 2020
Thanks for this. That is very strange because when I run the exact same code on my computer, it still gives me a convergence issue (the error which I mentioned in my original post). It worked smoothly for you when you ran it?
Arhant Sethia
Arhant Sethia el 20 de Mayo de 2020
If it makes any difference, I'm using the 2017 version?
William Alberg
William Alberg el 20 de Mayo de 2020
Im using the 2020a version
William Alberg
William Alberg el 20 de Mayo de 2020
I installed matlab 2017a, and i can't make it work either.
I also tried the lqe, care and icare commands, but they all seem to hit the same problem.
Arhant Sethia
Arhant Sethia el 20 de Mayo de 2020
Installed 2020a and it seems to work. Thanks for all your help!

Iniciar sesión para comentar.

Respuestas (0)

Productos

Versión

R2017a

Preguntada:

el 20 de Mayo de 2020

Comentada:

el 20 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by