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 个评论
William Alberg
2020-5-20
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
2020-5-20
编辑:Arhant Sethia
2020-5-20
Arhant Sethia
2020-5-20
William Alberg
2020-5-20
编辑:William Alberg
2020-5-20
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
2020-5-20
William Alberg
2020-5-20
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
2020-5-20
Arhant Sethia
2020-5-20
William Alberg
2020-5-20
Im using the 2020a version
William Alberg
2020-5-20
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
2020-5-20
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 State-Space Control Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!