
%Desfase entre velocidad y viento
clear
addpath /Francia/Estadisticas%aqui esta nanmean
addpath /Francia/Velocidades
addpath /Francia/vientos

load win23w.dat

u=win23w(:,3);
v=win23w(:,4);
t=num2str(win23w(:,1));
time=datenum(str2num(t(:,1:4)),str2num(t(:,5:6)),str2num(t(:,7:8)));

in1=find(datenum(2001,12,14)==time);
in2=find(datenum(2002,12,20)==time);
tt=time(1):time(end);
tiempo=time(in1):time(in2);


in3=find(u<-50);
u(in3)=NaN;
in4=find(v<-50);
    v(in4)=NaN;
u=completo_series1(u,5);
v=completo_series1(v,5);
u=interp1(time,u,tt);
v=interp1(time,v,tt);

vv=v(in1:in2);
uu=u(in1:in2);

load UV_moy_23w.mat
u=uvmoy23W(:,1:372);
v=uvmoy23W(:,373:372*2);
u16=u(6,:); %6 es 20
u40=u(11,:);
u60=u(16,:);
u80=u(21,:);
u100=u(26,:);
u120=u(31,:);

v16=v(6,:);%6 es 20
v40=v(11,:);
v60=v(16,:);
v80=v(21,:);
v100=v(26,:);
v120=v(31,:);

y1=v16';
y2=uu';
exp1=2;
exp2=8;
inter=40;
y=y1;
abc
aa=aa(45:75);
period=period(45:75);

conv_fft_abc

y1=y;
convolution1=wave;
y=y2;
%abc
conv_fft_abc;
y2=y;
convolution2=wave;
integration_essai;
%phase=unwrap(phase);
delay=(t.*phase/(2*pi));
for i=1:n1;
   xx(i)=i+delay(i);
%xx(i)=i-delay(i);
end;

%eje de tiempo

ejet=date23W;
ene1=ejet(19);
xx=[ene1, ene1+31, ene1+59, ene1+90, ene1+120,ene1+151,ene1+181,ene1+212,ene1+243,ene1+273,ene1+304,ene1+334];
aa=datestr(xx,4);
%fety1=fet(121:end);



fet2=ejet;
%x=fet2(1):30:fet2(end);
%a=datestr(x,12);


subplot(2,1,1)
plot(fet2,y1,'r')
hold on
plot(fet2,y2)
set(gca,'xlim',[min(fet2)-3 max(fet2)+3],'xtick',xx,'xticklabel',[])
legend('v-16 m','zonal wind')

axis tight
%legend('797 m','1293 m')
subplot(2,1,2)
plot(fet2,delay,'k')
ylabel('delay (days)')

set(gca,'xlim',[min(fet2)-3 max(fet2)+3],'xtick',xx,'xticklabel',aa)

orient landscape

