function [ua,va]=adcp_cvt(matfile)

eval(['load ' matfile 'time']);
eval(['load ' matfile 'u']);
eval(['load ' matfile 'v']); 
eval(['load ' matfile 'w']);
eval(['load ' matfile 'e']);
eval(['load ' matfile 'pg']); 
eval(['load ' matfile 'amp']);
eval(['load ' matfile 'nav']);
u = u / 1000; 
v = v / 1000;
w = w / 1000;
e = e / 1000;

[n1,n2]=size(u);
ua=ones(size(u));
va=ones(size(v));

for iknt=2:n2-1
 plot(v(:,iknt),-[1:1:100],'m--') 
  hold on
  plot(u(:,iknt),-[1:1:100],'b--') 

latlon=[nav(:,iknt-1) nav(:,iknt+1)];
[d,p]=sw_dist(latlon(2,:),latlon(1,:),'km')
  d = d*1000;
  p2 = p*pi/180;
  dt = (time(iknt+1)-time(iknt-1))*86400

ss = d/dt;
seast = ss*cos(p2);
snorth = ss*sin(p2);

 ua(:,iknt) = u(:,iknt)+seast;
 va(:,iknt) = v(:,iknt)+snorth;
 plot(va(:,iknt),-[1:1:100],'m')
 plot(ua(:,iknt)u,-[1:1:100],'b')
   pause(3)
   clf
 axis([0 2.5 -20 0])    
end
