clearvars
close all

% load('array_sim.mat');
load('array_simb1.mat');
load('array_exp.mat');


%% Tracé
x_lim = [-0.5 1.5];
y_lim = [0 4];


icas_exp = 1;
icas_sim_keps = 1;
n_pas=5;


U_exp_P=[array_exp(icas_exp).U_P1 array_exp(icas_exp).U_P2 array_exp(icas_exp).U_P3 array_exp(icas_exp).U_P4 array_exp(icas_exp).U_P5...
 array_exp(icas_exp).U_P6 array_exp(icas_exp).U_P7 array_exp(icas_exp).U_P8 array_exp(icas_exp).U_P9 array_exp(icas_exp).U_P10];

z_exp_P=[array_exp(icas_exp).z_P1 array_exp(icas_exp).z_P2 array_exp(icas_exp).z_P3 array_exp(icas_exp).z_P4 array_exp(icas_exp).z_P5...
 array_exp(icas_exp).z_P6 array_exp(icas_exp).z_P7 array_exp(icas_exp).z_P8 array_exp(icas_exp).z_P9 array_exp(icas_exp).z_P10];

U_sim_P=[array_sim(icas_sim_keps).U_P1 array_sim(icas_sim_keps).U_P2 array_sim(icas_sim_keps).U_P3 array_sim(icas_sim_keps).U_P4 array_sim(icas_sim_keps).U_P5...
 array_sim(icas_sim_keps).U_P6 array_sim(icas_sim_keps).U_P7 array_sim(icas_sim_keps).U_P8 array_sim(icas_sim_keps).U_P9 array_sim(icas_sim_keps).U_P10];

z_sim_P=[array_sim(icas_sim_keps).z_P1 array_sim(icas_sim_keps).z_P2 array_sim(icas_sim_keps).z_P3 array_sim(icas_sim_keps).z_P4 array_sim(icas_sim_keps).z_P5...
 array_sim(icas_sim_keps).z_P6 array_sim(icas_sim_keps).z_P7 array_sim(icas_sim_keps).z_P8 array_sim(icas_sim_keps).z_P9 array_sim(icas_sim_keps).z_P10];


U_sim_noench_P=[array_sim(32).U_P1 array_sim(32).U_P2 array_sim(32).U_P3 array_sim(32).U_P4 array_sim(32).U_P5...
 array_sim(32).U(:,405) array_sim(32).U(:,462) array_sim(32).U(:,520) array_sim(32).U(:,578) array_sim(32).U(:,634)];

z_sim_noench_P=[array_sim(32).z_P1 array_sim(32).z_P2 array_sim(32).z_P3 array_sim(32).z_P4 array_sim(32).z_P5...
 array_sim(32).z(:,405) array_sim(32).z(:,462) array_sim(32).z(:,520) array_sim(32).z(:,578) array_sim(32).z(:,634)];




F = figure('rend','painters','pos',[10 10 1500 1560],'DefaultAxesFontName','cmr10','defaulttextinterpreter','latex')
ha = tight_subplot(2,5,[.5 0.003],[.3 .01],[.09 .09])





for ii = 1
    axes(ha(ii));

    subplot(2,5,ii) 
    box on    
    hold on
    
    plot(U_exp_P(:,ii),z_exp_P(:,ii),'k-','MarkerFaceColor','k','linewidth', 3)
   
    plot(U_sim_P([1:n_pas:98 103:n_pas:end],ii),z_sim_P([1:n_pas:99 103:n_pas:end],ii),'r^','MarkerFaceColor','r','MarkerSize', 6)
    
    plot(U_sim_noench_P(:,ii),z_sim_noench_P(:,ii),'b--','MarkerFaceColor','b','linewidth', 3)

    hold off
    set(gca, 'FontSize',30);
    set(gca,'TickLabelInterpreter', 'Latex');
    hy = ylabel('$z/H_{1}$','FontSize',25);
    hx = xlabel('$ \overline{u}/U_{flow}$','FontSize',25);
    set(hx,'interpreter','Latex','FontSize',25)
    set(hy,'interpreter','Latex','FontSize',25)
    xlim([x_lim(1) x_lim(2)])
    ylim([y_lim(1) y_lim(2)])

    
end








for ii = 2:5
    
    axes(ha(ii));
    subplot(2,5,ii) 
    box on
    hold on
    
    plot(U_exp_P(:,ii),z_exp_P(:,ii),'k-','MarkerFaceColor','k','linewidth', 3)
   
    plot(U_sim_P([1:n_pas:98 103:n_pas:end],ii),z_sim_P([1:n_pas:99 103:n_pas:end],ii),'r^','MarkerFaceColor','r','MarkerSize', 6)
        

    plot(U_sim_noench_P(:,ii),z_sim_noench_P(:,ii),'b--','MarkerFaceColor','b','linewidth', 3)
    
    hold off
        
    set(gca, 'FontSize',30);
    set(gca,'TickLabelInterpreter', 'Latex');
%     hy = ylabel('$z/H_{1}$','FontSize',50);
    hx = xlabel('$ \overline{u}/U_{flow}$','FontSize',25);
    set(hx,'interpreter','Latex','FontSize',25)
%     set(hy,'interpreter','Latex','FontSize',50)
    xlim([x_lim(1) x_lim(2)])
    ylim([y_lim(1) y_lim(2)])
    set(gca, 'yTick', [])

    
end


pos_letter_x = -0.4;
pos_letter_y = 4.5;


subplot(2,5,1)
leg=legend(['$exp $'],...
['$sim \; k-\epsilon$'],...
['$sim \;no \;hill\; k-\epsilon$']);
set(leg,'Interpreter','Latex','Fontsize',30);
% position légende
% exemple pos_leg =[x y width, height];
pos_leg = [0.024, 0.495, .1, .04];
set(leg, 'Position', pos_leg)


    letter = '$x/H_{1}$=-2';
    text(pos_letter_x,pos_letter_y,letter,'Interpreter','latex','FontSize',30)
    box on
subplot(2,5,2)
    letter = '$x/H_{1}$=-1.4';
    text(pos_letter_x,pos_letter_y,letter,'Interpreter','latex','FontSize',30)
    box on
subplot(2,5,3)
    letter = '$x/H_{1}$=0';
    text(pos_letter_x,pos_letter_y,letter,'Interpreter','latex','FontSize',30)
        
    pos_letter_x1 = 0.2;
    pos_letter_y1 = -2.7;
    letter1 = '$(a)$';
    text(pos_letter_x1,pos_letter_y1,letter1,'Interpreter','latex','FontSize',30)   
    
    box on
subplot(2,5,4)
    letter = '$x/H_{1}$=1.4';
    text(pos_letter_x,pos_letter_y,letter,'Interpreter','latex','FontSize',30)
    box on
subplot(2,5,5)
    letter = '$x/H_{1}$=2';
    text(pos_letter_x,pos_letter_y,letter,'Interpreter','latex','FontSize',30)
    box on




for ii = 6
    axes(ha(ii));

    subplot(2,5,ii) 
    hold on
    box on
    
    plot(U_exp_P(:,ii),z_exp_P(:,ii),'k-','MarkerFaceColor','k','linewidth', 3)
   
    plot(U_sim_P([1:n_pas:98 103:n_pas:end],ii),z_sim_P([1:n_pas:99 103:n_pas:end],ii),'r^','MarkerFaceColor','r','MarkerSize', 6)
    
       

    plot(U_sim_noench_P(:,ii),z_sim_noench_P(:,ii),'b--','MarkerFaceColor','b','linewidth', 3)    

    hold off   
        
    set(gca, 'FontSize', 30);
    set(gca,'TickLabelInterpreter', 'Latex');
    hy = ylabel('$z/H_{1}$','FontSize',25);
    hx = xlabel('$ \overline{u}/U_{flow}$','FontSize',25);
    set(hx,'interpreter','Latex','FontSize',25)
    set(hy,'interpreter','Latex','FontSize',25)
    xlim([x_lim(1) x_lim(2)])
    ylim([y_lim(1) y_lim(2)])


end





for ii = 7:10
 axes(ha(ii));
    subplot(2,5,ii) 
    hold on
    box on

    plot(U_exp_P(:,ii),z_exp_P(:,ii),'k-','MarkerFaceColor','k','linewidth', 3)
   
    plot(U_sim_P([1:n_pas:98 103:n_pas:end],ii),z_sim_P([1:n_pas:99 103:n_pas:end],ii),'r^','MarkerFaceColor','r','MarkerSize', 6)
        

    plot(U_sim_noench_P(:,ii),z_sim_noench_P(:,ii),'b--','MarkerFaceColor','b','linewidth', 3)    

    hold off
        
    set(gca, 'FontSize', 30);
    set(gca,'TickLabelInterpreter', 'Latex');
%     hy = ylabel('$z/H_{1}$','FontSize',50);
    hx = xlabel('$ \overline{u}/U_{flow}$','FontSize',25);
    set(hx,'interpreter','Latex','FontSize',25)
%     set(hy,'interpreter','Latex','FontSize',50)
    xlim([x_lim(1) x_lim(2)])
    ylim([y_lim(1) y_lim(2)])
    set(gca, 'yTick', [])

    
end





pos_letter_x = -0.5;
pos_letter_y = 7.;


 subplot(2,5,8)
    pos_letter_x1 = 0.2;
    pos_letter_y1 = -2.7;
    letter1 = '$(b)$';
    text(pos_letter_x1,pos_letter_y1,letter1,'Interpreter','latex','FontSize',30)   

    
    
