Révision 463
Ajouté par chsabot il y a presque 4 ans
branch/sabot/sp4abc/sp4a3/sp4a3_kalman.c | ||
---|---|---|
Sub_Mat_Mat(2,1,T21a,2,1,T21b,R21); if (!Equal_Mat_Mat(RST21,R21)) error("Erreur calcul Soustraction 2x1");
|
||
Sub_Mat_Mat(4,4,T44a,4,4,T44b,R44); if (!Equal_Mat_Mat(RST44,R44)) error("Erreur calcul Soustraction 4x4");
|
||
Mul_Mat_Mat(4,4,T44a,4,4,T44b,R44); if (!Equal_Mat_Mat(RMT44T44,R44)) error("Erreur calcul Multiplication 4x4 4x4");
|
||
//Mul_Mat_Mat(4,4,T44a,4,1,T41a,R41); if (!Equal_Mat_Mat(RMT44T41,R41)) error("Erreur calcul Multiplication 4x4 4x1");
|
||
//Mul_Mat_Mat(4,4,T44a,4,2,T42a,R42); if (!Equal_Mat_Mat(RMT44T42,R42)) error("Erreur calcul Multiplication 4x4 4x2");
|
||
//Mul_Mat_Mat(4,2,T42a,2,1,T21a,R41); if (!Equal_Mat_Mat(RMT42T21,R41)) error("Erreur calcul Multiplication 4x2 2x1");
|
||
//Mul_Mat_Mat(4,2,T42a,2,2,T22a,R42); if (!Equal_Mat_Mat(RMT42T22,R42)) error("Erreur calcul Multiplication 4x2 2x2");
|
||
//Mul_Mat_Mat(4,2,T42a,2,4,T24,R44); if (!Equal_Mat_Mat(RMT42T24,R44)) error("Erreur calcul Multiplication 4x2 2x4");
|
||
//Mul_Mat_Mat(2,4,T24,4,1,T41a,R21); if (!Equal_Mat_Mat(RMT24T41,R21)) error("Erreur calcul Multiplication 2x4 4x1");
|
||
//Mul_Mat_Mat(2,4,T24,4,2,T42a,R22); if (!Equal_Mat_Mat(RMT24T42,R22)) error("Erreur calcul Multiplication 2x4 4x2");
|
||
//Mul_Mat_Mat(2,4,T24,4,4,T44a,R24); if (!Equal_Mat_Mat(RMT24T44,R24)) error("Erreur calcul Multiplication 2x4 4x4");
|
||
Mul_Mat_Mat(4,4,T44a,4,1,T41a,R41); if (!Equal_Mat_Mat(RMT44T41,R41)) error("Erreur calcul Multiplication 4x4 4x1");
|
||
Mul_Mat_Mat(4,4,T44a,4,2,T42a,R42); if (!Equal_Mat_Mat(RMT44T42,R42)) error("Erreur calcul Multiplication 4x4 4x2");
|
||
Mul_Mat_Mat(4,2,T42a,2,1,T21a,R41); if (!Equal_Mat_Mat(RMT42T21,R41)) error("Erreur calcul Multiplication 4x2 2x1");
|
||
Mul_Mat_Mat(4,2,T42a,2,2,T22a,R42); if (!Equal_Mat_Mat(RMT42T22,R42)) error("Erreur calcul Multiplication 4x2 2x2");
|
||
Mul_Mat_Mat(4,2,T42a,2,4,T24,R44); if (!Equal_Mat_Mat(RMT42T24,R44)) error("Erreur calcul Multiplication 4x2 2x4");
|
||
Mul_Mat_Mat(2,4,T24,4,1,T41a,R21); if (!Equal_Mat_Mat(RMT24T41,R21)) error("Erreur calcul Multiplication 2x4 4x1");
|
||
Mul_Mat_Mat(2,4,T24,4,2,T42a,R22); if (!Equal_Mat_Mat(RMT24T42,R22)) error("Erreur calcul Multiplication 2x4 4x2");
|
||
Mul_Mat_Mat(2,4,T24,4,4,T44a,R24); if (!Equal_Mat_Mat(RMT24T44,R24)) error("Erreur calcul Multiplication 2x4 4x4");
|
||
Transpose_Mat(2,4,T24,R42); if (!Equal_Mat_Mat(RTT24,R42)) error("Erreur calcul Transposition 2x4");
|
||
Transpose_Mat(4,4,T44a,R44); if (!Equal_Mat_Mat(RTT44,R44)) error("Erreur calcul Transposition 4x4");
|
||
//Inverse_Mat_22(2,2,T22a,R22); if (!Equal_Mat_Mat(RInvT22,R22)) error("Erreur calcul Inversion 2x2");
|
||
Inverse_Mat_22(2,2,T22a,R22); if (!Equal_Mat_Mat(RInvT22,R22)) error("Erreur calcul Inversion 2x2");
|
||
printf("Test unitaires OK.\n");
|
||
}
|
||
|
||
... | ... | |
double Ht[4][2];
|
||
double S1[2][4];//Matrice intermédiaire de calcul
|
||
double S2[2][2];//Matrice intermédiaire de calcul
|
||
double S2t[2][2];//Matrice intermédiaire de calcul
|
||
double S2i[2][2];//Matrice intermédiaire de calcul
|
||
Transpose_Mat(2,4,H,Ht);
|
||
Mul_Mat_Mat(4,4,P,4,2,Ht,K);//P*Ht
|
||
Mul_Mat_Mat(2,4,H,4,4,P,S1);//H*P
|
||
Mul_Mat_Mat(2,4,S1,4,2,Ht,S2);//H*P*Ht
|
||
Add_Mat_Mat(2,2,S2,2,2,R,S2);
|
||
Inverse_Mat_22(2,2,S2,S2t);
|
||
Mul_Mat_Mat(4,2,K,2,2,Ht,K);
|
||
Inverse_Mat_22(2,2,S2,S2i);
|
||
Mul_Mat_Mat(4,2,K,2,2,S2i,K);
|
||
|
||
Plot_Mat(K,"K = ");
|
||
|
||
//X = X + K*([xb(i);yb(i)]-H*X);
|
||
double Obs[2][1]={{x},{y}};
|
||
double S[2][1];//Matrice intermédiaire de calcul
|
||
double S0[4][2];
|
||
Mul_Mat_Mat(2,4,H,4,1,X,S);
|
||
Sub_Mat_Mat(2,1,Obs,2,1,S,S);
|
||
Mul_Mat_Mat(4,2,K,2,1,S,S0);
|
||
double Delta[2][1];//Matrice intermédiaire de calcul
|
||
double S0[4][1];
|
||
Mul_Mat_Mat(2,4,H,4,1,X,Delta);
|
||
Sub_Mat_Mat(2,1,Obs,2,1,Delta,Delta);
|
||
|
||
Plot_Mat(Delta,"DELTA = Obs - H.X(k+1|k)");
|
||
|
||
Mul_Mat_Mat(4,2,K,2,1,Delta,S0);
|
||
Add_Mat_Mat(4,1,X,4,1,S0,X);
|
||
|
||
//Plot_Mat(Delta,"DELTA = Obs - H.X(k+1|k)");
|
||
|
||
Plot_Mat(X," X(k+1|k+1) = X(k+1|k) + K.Delta = ");
|
||
|
||
// P = P - K*H*P;
|
Formats disponibles : Unified diff
Modification filtre de Kalman