% ðèñóåì dIdD è òåìïåðàòóðó

load TR_dIdD_2021_01-12_Minute.mat
load one_min_2021_01_12_didd_pos_with_const_D0I0F0.mat
load 2021_deltaF_didd_pos1_TRdidd_delay_scale Tlags Lags VdeltaF

deltaF=Fdidd-Fpos;

% âðåìÿ â ñóòêàõ
[year,mon,day]=datevec(min(Ttr_didd));
day_tr=Ttr_didd-datenum(year,1,1)+1;
[year,mon,day]=datevec(min(Tdidd));
day_didd=Tdidd-datenum(year,1,1)+1;


% plot(day_didd,-deltaF*10,day_tr,TR_didd)

k1=between_my(Tdidd,datenum(2021,01,01),datenum(2021,01,11));
k2=between_my(Tdidd,datenum(2021,08,01),datenum(2021,08,11));

figure(3)

subplot(221)
[ax0,ax1,ax2]=plotyy(day_didd(k1),-deltaF(k1),day_tr(k1),TR_didd(k1));
set(ax1,'Color',[0.5 0.5 0.5])
set(ax2,'Color','k','Marker','.')
set(ax0(2),'Ylim',[-16 -2],'YTick',[-15 -10 -5],'YColor','k')
set(ax0(1),'YColor','k')
ylabel(ax0(1),'deltaF, nT')
xlabel(ax0(1),...
    [datestr(min(Tdidd(k1)),'dd') '-' datestr(max(Tdidd(k1)),'dd.mmm.yyyy')])
title('(a)')
legend('delatF','Temperature','Location','SouthWest')

subplot(222)
[ax0,ax1,ax2]=plotyy(day_didd(k2),-deltaF(k2),day_tr(k2),TR_didd(k2));
set(ax1,'Color',[0.5 0.5 0.5])
set(ax2,'Color','k','Marker','.')
set(ax0(2),'Ylim',[7 21],'YTick',[10 15 20],'YColor','k')
set(ax0(1),'YColor','k')
ylabel(ax0(2),'Temperature, ^oC')
xlabel(ax0(1),...
    [datestr(min(Tdidd(k2)),'dd') '-' datestr(max(Tdidd(k2)),'dd.mmm.yyyy')])
title('(b)')

[year,mon,day]=datevec(min(Tlags));
day_lags=Tlags-datenum(year,1,1)+1;
subplot(212)
[ax0,ax1,ax2]=plotyy(day_lags,Lags,day_lags,VdeltaF(:,1));
set(ax1,'Color','k','Marker','o')
set(ax2,'Color','k','Marker','*')
set(ax0(1),'Xlim',[0 366],'XTick',(0:61:366),'YColor','k')
set(ax0(2),'Xlim',[0 366],'XTick',(0:61:366),'YColor','k')
ylabel(ax0(1),'Delay, min'),xlabel(ax0(1),'Days of 2021')
set(ax0(2),'YColor','k')
ylabel(ax0(2),'temp.coeff, nT/^oC')
legend('delay','temp.coeff','Location','North')
title('(c)')
