%desfase
clear
addpath /Francia/annie
load UV_moy_23w.mat

load v_20_40
jj=find(isnan(uhatz)==1);
uhatz2=uhatz;
uhatz(jj)=0;

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;

%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(1:end-1);
%x=fet2(1):30:fet2(end);
%a=datestr(x,12);
o1=.1; a1=.1;
o2=.4; o3=.7; w=.80; h=.27;
subplot('position',[a1,o3,w,h])
plot(fet2,uhatz2)
yoffset 10
set(gca,'xlim',[min(fet2)-3 max(fet2)+3],'xtick',xx,'xticklabel',[],'fontsize',12)
axis tight
text(max(fet2)+6, 40, '797 m','fontsize',12)
text(max(fet2)+6, 30, '1030 m','fontsize',12)
text(max(fet2)+6, 20, '1184 m','fontsize',12)
text(max(fet2)+6, 10, '1293 m','fontsize',12)
text(max(fet2)+6, 0, '1433 m','fontsize',12)
jj=find(isnan(uhatz2(:,4))==1);
subplot('position',[a1,o2,w,h])
plot(fet2,y1,'r')
hold on
y2(jj)=nan;
plot(fet2,y2)
set(gca,'xlim',[min(fet2)-3 max(fet2)+3],'xtick',xx,'xticklabel',[],'fontsize',12)
axis tight
%legend('797 m','1293 m')
subplot('position',[a1,o1,w,h])
plot(fet2,delay,'k')
ylabel('delay (days)','fontsize',12)

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

orient landscape
