clear;
close all;


% load ('H1_ISI_HAM3_TF_L2L_Raw_2014_09_10.mat');
load ('C:\cygwin64\ligo\HAM2\Undamped\H1_ISI_HAM2_TF_L2L_Raw_2014_09_16');
HAM2_frd=TF_L2L_Undamped_frd;

load ('C:\cygwin64\ligo\Undamped\H1_ISI_HAM3_TF_L2L_Raw_2014_09_10.mat');

H1_ISI_HAM2_TF_L2L_Raw_2014_09_13
for ii =1:6
    for jj= 1:6
        figure(ii)
        loglog(TF_L2L_Undamped_frd(ii,jj).Frequency,abs(squeeze(TF_L2L_Undamped_frd(ii,jj).ResponseData)));
        %set(gca,'Color',
        hold on;
    end
end


%%

freq = TF_L2L_Undamped_frd(1,1).Frequency;

figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(1+6,1).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(2+6,2).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(3+6,3).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('Horz on diagonal (h1->h1, etc)')

figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(2+6,1).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(3+6,2).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(1+6,3).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('H1-H2, H2-> h3, H3->h1')
%%
figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(3+6,1).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(1+6,2).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(2+6,3).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('H1->H3, H2-> H1, H3->H2')


%%


figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(4+6,4).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(5+6,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('Vert on diagonal (V1->V1, etc)')


figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(5+6,4).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(4+6,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('V1->V2, V2->V3 V3->V1')

figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,4).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(4+6,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(5+6,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('V4->V6, V5->V4, V6->V5')

%% and the horz to vert couplings
figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(4+6,1).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(5+6,1).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,1).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('Vert on diagonal (H1->V1, V2, V3, etc)')

figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(4+6,2).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(5+6,2).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,2).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(4+6,3).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(5+6,3).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,3).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('Vert on diagonal (H2->V1, V2, V3, H3-> V1, V2, V3)')

%%
figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+1,4).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+2,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+3,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('Vert on diagonal (V1->H1, V2->H2, V3->H3')


figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+2,4).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+3,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+1,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('Vert on diagonal (V1->H2, V2->H3, V3->H1')

figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+3,4).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+1,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+2,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('Vert on diagonal (V1->H3, V2->H1, V3->H2')

%%


figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+1,6).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+2,6).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+3,6).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+4,6).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+5,6).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('V3 drive to H1...V3')

%%
figure
ll= loglog(...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+1,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+2,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+3,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+4,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+5,5).ResponseData)),...
    freq, abs(squeeze(TF_L2L_Undamped_frd(6+6,5).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('V2 drive to H1...V3')

%%
ham2_freq=HAM2_frd(1,1).Frequency;
figure
ll= loglog(...
    ham2_freq, abs(squeeze(HAM2_frd(6+1,5).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+2,5).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+3,5).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+4,5).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+5,5).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+6,5).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('V2 drive to H1...V3')

%%
ham2_freq=HAM2_frd(1,1).Frequency;
figure
ll= loglog(...
    ham2_freq, abs(squeeze(HAM2_frd(6+1,6).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+2,6).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+3,6).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+4,6).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+5,6).ResponseData)),...
    ham2_freq, abs(squeeze(HAM2_frd(6+6,6).ResponseData)));
set(ll,'LineWidth',2)
grid on
xlim([freq(2), 5])
title('HAM2 V3 drive to')
legend('H1','H2','H3','V1','V2','V3')