Dear All,
I am trying to calculation Kalman gain for the following system,
R=73; C=220e-6; L=450e-6; Rl=0.3;
Ts=2.5e-6;
A1=[-Rl/L -1/L; 1/C -1/R*C];
A1d0=[0 0; 0 -1/R*C];
A2=[0 1/L; -1/C 0];
B1=[1/L ; 0];
B1d0=[0 ; 0];
E1= eye(2) + (A1 + A2)*Ts;
E2=eye(2) + A1*Ts;
E4=eye(2) + A1d0*Ts;
E3=(1/Ts)*(0.5*E2 + 0.5*E4);
F1=B1*Ts;
F2=B1*Ts;
F3=B1d0*0.5*Ts;
E1a= [E1 zeros(2); zeros(2) eye(2)];
E2a= [E2 zeros(2); zeros(2) eye(2)];
E3a= [E3 zeros(2); zeros(2) eye(2)];
E4a= [E4 zeros(2); zeros(2) eye(2)];
F1a= [F1' 0 0]';
F2a= [F2' 0 0]';
F3a= [F3' 0 0]';
F4a= [0 0 0 0]';
Ga= [eye(2) eye(2)];
S1=ss(E1a, F1a, Ga, 0, -1);
S2=ss(E2a, F2a, Ga, 0, -1);
S3=ss(E3a, F3a, Ga, 0, -1);
S4=ss(E4a, F4a, Ga, 0, -1);
q=[0.1 0.1 50 50];
r=[1 1];
Q= diag(q);
R= diag(r);
[~,K1,~] = kalman(S1, Q, R);
[~,K2,~] = kalman(S2, Q, R);
[~,K3,~] = kalman(S3, Q, R);
[~,K4,~] = kalman(S4, Q, R);
using this syntax
[kest,L,P] = kalman(sys,Qn,Rn,Nn)
Although, Q is an 4*4 real and square matrices, but the code still giving this error,
""Error using ss/kalman (line 101)
In the "kalman(SYS,QN,RN,NN,...)" command, QN must be a real square matrix with at most 1 rows.
Error in adnanan (line 33)
[~,K1,~] = kalman(S1, Q, R);""
Need yours help and suggestions.
Regards,
Adnan Ahmad