Projet

Général

Profil

« Précédent | Suivant » 

Révision 651

Ajouté par jcguifodjo il y a presque 4 ans

Correction decode_trame et conversion de latitude et longitude en dégrée flottant
Fin de l'implémentation du filtre de Kalman

Voir les différences:

sp4a3_kalman.c
#include "sp4a3_kalman_extra.h"
//Addition de matrices
void Add_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double B[nb][mb], double out[na][ma]){
int i,j;
......
}
//Inversion d'une matrice
void Inverse_Mat_22(int n,int m,double A[n][m],double B[n][m]){
double det;
......
B[1][0]=-(A[1][0])/det;
B[1][1]=(A[0][0])/det;
}
//Transposée de matrices
void Transpose_Mat(int n,int m,double A[n][m],double R[m][n]){
int i,j;
for (i=0;i<n;i++)
for (j=0;j<m;j++)
R[j][i]=A[i][j];
}
//Soustraction de matrices
void Sub_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double b[nb][mb], double out[na][ma]){
int i,j;
for(i=0;i<na;i++)
for(j=0;j<ma;j++)
out[i][j]=A[i][j]-b[i][j];
}
//Multiplication de matrices
void Mul_Mat_Mat(int na,int ma,double A[na][ma], int nb,int mb,double B[nb][mb], double out[na][mb]){
int i,j,k;
for (i=0; i<na; i++)
......
Plot_Mat(K,"K = ");
//X = X + K*([xb(i);yb(i)]-H*X);
//Plot_Mat(Delta,"DELTA = Obs - H.X(k+1|k)");
Obs[0][0]=x;
Obs[1][0]=y;
Mul_Mat_Mat(2,4,H,4,1,X,E);
Sub_Mat_Mat(2,1,Obs,2,1,E,delta);
Mul_Mat_Mat(4,2,K,2,1,delta,C1);
Add_Mat_Mat(4,1,X,4,1,C1,X);
Add_Mat_Mat(4,1,X,4,1,C1,X);
Plot_Mat(Obs,"Obs = ");
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;
Mul_Mat_Mat(4,2,K,2,4,H,A3);
Mul_Mat_Mat(4,4,A3,4,4,P,A4);
Sub_Mat_Mat(4,4,P,4,4,A4,P);

Formats disponibles : Unified diff