%desfase
clear
addpath /Francia/annie
addpath /Francia/Programitas
addpath /Francia/Temperatura
load T2002_23w_pirata -ascii
load UV_moy_23w.mat
temp60=T2002_23w_pirata(:,6);
jj=find(temp60<0); temp60(jj)=nan;
t60=completo_series1(temp60,5);

load Sal2002_23w_pirata -ascii
sal40=Sal2002_23w_pirata(:,5);
jj=find(sal40<0); sal40(jj)=nan;
s40=completo_series1(sal40,5);
t60=t60(1:end-10);
s40=s40(1:end-10);
vv=uvmoy23W(:,373:744);
uu=uvmoy23W(:,1:372);
load v_20_40
jj=find(isnan(uhatz)==1);
uhatz(jj)=0;
vv1=vv(11,:); %20m, 11 es 40 16= 60, 21= 80...
vv2=vv(31,:); %120m
vv2=completo_series1(vv2,5);
vv1=vv1(18:end);
y1=uhatz(:,1);
y2=uhatz(:,4);
exp1=2;
exp2=8;
inter=40;
y=y1;
abc
aa=aa(80:130);
period=period(80:130);

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;
%xxx=[1:n1];
%yyy=interp1(xx,y1,xxx);
%yyy=yyy';

%eje de tiempo

time=date23W;
%fety1=fet(121:end);



fet2=time(1:end-1);
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',x,'xticklabel',[])
%title('14 day signal (from wavelet spectra) for the SST (blue) and the adcp meridional component (red) at 10 W')
legend('1293 m','1433 m')
subplot(2,1,2)
plot(fet2,delay,'k')
ylabel('delay (days)')

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

orient landscape
