%calcul de la vitesse du bateau 
%a partir des donnees de navigation
 factphi=60*1852;
 alpha=(43.41*pi)/180;
 factl=60*1852*cos(alpha);

 for i=1:1:119
 phi(i)=dyntr3he(i+2,5)-dyntr3he(i,5);
 l(i)=dyntr3he(i+2,6)-dyntr3he(i,6);
 dist1(i)=phi(i)*factphi;
 dist2(i)=l(i)*factl;
 vnship(i)=(dist1(i)/(4*60))*1000; 
 veship(i)=(dist2(i)/(4*60))*1000; 
 end
 vnshiptr3=vnship';
 veshiptr3=veship';
 veshiptr3=[veshiptr3(1)  
 veshiptr3
 veshiptr3(119)];
 vnshiptr3=[vnshiptr3(1)  
 vnshiptr3
 vnshiptr3(119)];

%calcul des vitesses relatives 
%vitesse de reference: bin25-30
 vereftr3=mean(dyntr3ve(:,25:30)'); 
 vnreftr3=mean(dyntr3vn(:,25:30)'); 
 for j=1:24
 vereltr3(:,j)=dyntr3ve(:,j)-vereftr3'; 
 vnreltr3(:,j)=dyntr3vn(:,j)-vnreftr3'; 
 end
 vereftr3=vereftr3';
 vnreftr3=vnreftr3';

%calcul des vitesses absolues de reference
 veabsreftr3=vereftr3+veshiptr3; 
 vnabsreftr3=vnreftr3+vnshiptr3; 
 plot(veabsreftr3)
 pause
 plot(vnabsreftr3)
 pause
