Révision 465
Ajouté par Stephen LOPEZ il y a presque 3 ans
branch/LOPEZ_Stephen/tp_sp4_2022_LOPEZ_Stephen/sp4a3/sp4a3_kalman.c | ||
---|---|---|
|
||
|
||
void Add_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double B[nb][mb], double R[na][ma]){
|
||
|
||
|
||
int i,j;
|
||
na=nb;
|
||
ma=mb;
|
||
for(i=0;i<na;i++)
|
||
{
|
||
for(j=0;j<ma;j++)
|
||
{
|
||
R[i][j]=A[i][j]+B[i][j];
|
||
}
|
||
}
|
||
}
|
||
|
||
void Inverse_Mat_22(int n,int m,double A[n][m],double B[n][m]){
|
||
|
||
double det=1/((A[0][0]*A[1][1])-(A[0][1]*A[1][0]));
|
||
B[1][1]=A[0][0]*det;
|
||
B[0][0]=A[1][1]*det;
|
||
B[1][0]=-A[1][0]*det;
|
||
B[0][1]=-A[0][1]*det;
|
||
|
||
printf("%f %f\n %f %f\n",B[0][0],B[0][1],B[1][0],B[1][1]);
|
||
}
|
||
|
||
void Transpose_Mat(int n,int m,double A[n][m],double R[m][n]){
|
||
... | ... | |
}
|
||
|
||
void Sub_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double B[nb][mb], double R[na][ma]){
|
||
|
||
int i,j;
|
||
na=nb;
|
||
ma=mb;
|
||
for(i=0;i<na;i++)
|
||
{
|
||
for(j=0;j<ma;j++)
|
||
{
|
||
R[i][j]=A[i][j]-B[i][j];
|
||
}
|
||
}
|
||
}
|
||
|
||
void Mul_Mat_Mat(int na,int ma,double A[na][ma], int nb,int mb,double B[nb][mb], double R[na][mb]){
|
||
|
||
|
||
int i=0,j=0,k=0;
|
||
ma=nb;
|
||
for(i=0;i<na;i++)
|
||
{
|
||
for(j=0;j<mb;j++)
|
||
{
|
||
R[i][j]=0;
|
||
}
|
||
}
|
||
for(i=0;i<na;i++)
|
||
{
|
||
for(j=0;j<mb;j++)
|
||
{
|
||
for(k=0;k<nb;k++)
|
||
{
|
||
R[i][j]+=A[i][k]*B[k][j];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
... | ... | |
debug=0; ///Mettre à 1 pour afficher les matrices.
|
||
///Ajouter votre code ci-dessous///
|
||
// Kalman
|
||
|
||
|
||
|
||
|
||
|
||
// X = F*X
|
||
Plot_Mat(X," X(k+1|k) = ");
|
Formats disponibles : Unified diff
Les opérations matricielles fonctionne correctement.
Début du code pour le filtre de Kalman.