Index: branch/beaufour/sp4a12/main.c
===================================================================
--- branch/beaufour/sp4a12/main.c	(revision 258)
+++ branch/beaufour/sp4a12/main.c	(revision 259)
@@ -61,9 +61,45 @@
     return nb;
 }
 
-int decode_longitude (char ch[], int x
+
+float conv_sexa_decimal(char chaine[]){
+
+    int i=0, degre=0, minutes=0, u=1, w=-1, n=0;
+    float min_sec=0, secondes=0, res=0, min=0;
+
+    do{
+        n++;
+    }while(chaine[n]!='.');
+
+    if(n==4){
+        degre=(chaine[0]-48)*10+(chaine[1]-48);
+        i=2;
+    }
+    else{
+        degre=(chaine[0]-48)*100+(chaine[1]-48)*10+(chaine[2]-48);
+        i=3;
+    }
+
+    do{
+        min=min+(chaine[i]-48)*pow(10, u);
+        u--;
+        i++;
+    }while(chaine[i]!='.');
+    i++;
+    do{
+        secondes=secondes+(chaine[i]-48)*pow(10, u);
+        u--;
+        i++;
+    }while(chaine[i]!='\0');
+
+    res=degre+(min+secondes)/60;
+
+    return res;
+
+
+}
+
 
-
 //Ajouter vos tests unitaires dans cette fonction.
 void tests_unitaires(void){
     if (5!=5){
Index: branch/beaufour/sp4a3/sp4a3_kalman.c
===================================================================
--- branch/beaufour/sp4a3/sp4a3_kalman.c	(revision 258)
+++ branch/beaufour/sp4a3/sp4a3_kalman.c	(revision 259)
@@ -7,14 +7,24 @@
 #include "sp4a3_kalman_extra.h"
 
 
-void Add_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double b[nb][mb], double out[na][ma]){
-
+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;
+    for (i=0;i<na;i++)
+		for (j=0;j<ma;j++)
+			out[i][j]=A[i][j] + B[i][j];
 }
 
 void Inverse_Mat_22(int n,int m,double A[n][m],double B[n][m]){
-
+    int i,j;
+    double det;
+    det = A[0][0]*A[1][1]-A[1][0]*A[0][1];
+    B[0][0] = (A[1][1])/det;
+    B[0][1] = - (A[0][1])/det;
+    B[1][0] = - (A[1][0])/det;
+    B[1][1] = (A[0][0])/det;
 }
 
+
 void Transpose_Mat(int n,int m,double A[n][m],double R[m][n]){
 	int i,j;
 	for (i=0;i<n;i++)
@@ -22,13 +32,25 @@
 			R[j][i]=A[i][j];
 }
 
-void Sub_Mat_Mat(int na,int ma,double A[na][ma],int nb,int mb,double b[nb][mb], double out[na][ma]){
-
+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];
 }
 
 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,sum;
+    for (i=0;i<na;i++)
+		for (j=0;j<mb;j++){
+		sum=0;
+            for(k = 0; k < ma; k++)
+			{
+			    sum += A[i][k] * B[k][j];
+			}
+			out[i][j]=sum;
 }
+}
 
 
 
@@ -151,24 +173,48 @@
 			Plot_Mat(R,"R = ");
 		}
 		else
-		{
+		{
+		    getchar();
 			t -= t0;x -= x0;y -= y0;
 
-			debug=0; ///Mettre à 1 pour afficher les matrices.
+			debug=1; ///Mettre à 1 pour afficher les matrices.
 			///Ajouter votre code ci-dessous///
 			// Kalman
 
-			// X = F*X
+			// X = F*X
+
+			Mul_Mat_Mat(4,4,F, 4,1,X, X);
 			Plot_Mat(X," X(k+1|k) = ");
 
-			//P = F*P*F'+Q;
+			//P = F*P*F'+Q;
+			double intern[4][4]
+			Mul_Mat_Mat(4,4,F, 4,4,P, intern);
+			Mul_Mat_Mat(4,4,intern, 4,4,FT, intern);
+			Add_Mat_Mat(4,4,intern,4,4,Q, P);
 			Plot_Mat(P,"P(k+1|k) = F.P(k|k).FT + Q = ");
 
-			// K = P*H' / ( H*P*H' + R);
-			Plot_Mat(K,"K = ");
+			// K = P*H' / ( H*P*H' + R);
+			{
+			    double Denom1[2][4];
+                double Denom[2][2];
+                double num[4][2];
+                Mul_Mat_Mat(2,4,H, 4,4,P, Denom1);
+                Mul_Mat_Mat(2,4,Denom1, 4,2,HT, Denom);
+                Add_Mat_Mat(2,2,Denom,2,2,R, Denom);
+                Mul_Mat_Mat(4,4,P, 4,2,HT, num);
+                Inverse_Mat_22(2,2,Denom,Denom);
+                Mul_Mat_Mat(4,2,num, 2,2,Denom, K);
+                Plot_Mat(K,"K = ");
+			}
 
+
 			//X = X + K*([xb(i);yb(i)]-H*X);
-			//Plot_Mat(Delta,"DELTA = Obs - H.X(k+1|k)");
+			Plot_Mat(Delta,"DELTA = Obs - H.X(k+1|k)");
+                double obs[2][1] = {{x},{y}};
+                double Delta[2][1];
+                Mul_Mat_Mat(2,4,H, 4,1,X, Delta);
+                Sub_Mat_Mat(2,1,obs,2,1,Delta, Delta);
+
             Plot_Mat(X," X(k+1|k+1) = X(k+1|k) + K.Delta = ");
 
 			// P = P - K*H*P;
