clearvars
close all


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




U_deb=0.3567405;

H=0.065;%en m


[Us,Uc,delta,x_proj] = calc_delta_lm(array_sim(27).xst,array_sim(27).zst,array_sim(27).x,array_sim(27).z,array_sim(27).U,array_sim(27).W,array_sim(27).k,3731,1e-5,156);

[Us_l120,Uc_l120,delta_l120,x_proj_l120] = calc_delta_lm(array_sim(13).xst,array_sim(13).zst,array_sim(13).x,array_sim(13).z,array_sim(13).U,array_sim(13).W,array_sim(13).k,3611,3e-3,157);

[Us_l84,Uc_l84,delta_l84,x_proj_l84] = calc_delta_lm(array_sim(11).xst,array_sim(11).zst,array_sim(11).x,array_sim(11).z,array_sim(11).U,array_sim(11).W,array_sim(11).k,5201,3e-3,157);

[Us_l60,Uc_l60,delta_l60,x_proj_l60] = calc_delta_lm(array_sim(9).xst,array_sim(9).zst,array_sim(9).x,array_sim(9).z,array_sim(9).U,array_sim(9).W,array_sim(9).k,5481,1e-3,156);

[Us_l55,Uc_l55,delta_l55,x_proj_l55] = calc_delta_lm(array_sim(7).xst,array_sim(7).zst,array_sim(7).x,array_sim(7).z,array_sim(7).U,array_sim(7).W,array_sim(7).k,5841,1e-3,155);

[Us_l45,Uc_l45,delta_l45,x_proj_l45] = calc_delta_lm(array_sim(5).xst,array_sim(5).zst,array_sim(5).x,array_sim(5).z,array_sim(5).U,array_sim(5).W,array_sim(5).k,4561,3.8e-3,149);

[Us_l38,Uc_l38,delta_l38,x_proj_l38] = calc_delta_lm(array_sim(3).xst,array_sim(3).zst,array_sim(3).x,array_sim(3).z,array_sim(3).U,array_sim(3).W,array_sim(3).k,3550,3.8e-3,145);




figure('rend','painters','pos',[10 10 1500 600])
box on
hold on
x_fit=0:0.5:7;
delta_th1=0.06*(Us/Uc).*x_fit;
% delta_th2=0.11*(Us(1)/Uc(1)).*x_fit;

delta_th2=0.1*(Us/Uc).*x_fit;

plot(x_proj(231,1:5:end)./H,delta(1:5:end)./H,'k*');
plot(x_proj_l120(232,1:5:end-1)./H,delta_l120(1:5:end-1)./H,'k+');
plot(x_proj_l84(232,1:5:end-1)./H,delta_l84(1:5:end-1)./H,'ko');
plot(x_proj_l60(232,1:5:end-1)./H,delta_l60(1:5:end-1)./H,'kd');
plot(x_proj_l55(232,1:5:end-1)./H,delta_l55(1:5:end-1)./H,'k<');
plot(x_proj_l45(232,1:5:end-1)./H,delta_l45(1:5:end-1)./H,'kp');
plot(x_proj_l38(232,1:5:end-1)./H,delta_l38(1:5:end-1)./H,'kx');
plot(x_fit,delta_th2,'k--');
% x_fit=0:0.5:7;
% deltaH_fit=0.23834.*x_fit+0.7;

y_lim = [0 1.5];
x_lim = [0 7.2];
    hy = ylabel('$\delta/H_{1}$','FontSize',30);
    hx = xlabel('$x/H_{1}$','FontSize',30);
    set(hx,'interpreter','Latex','FontSize',15)
    set(hy,'interpreter','Latex','FontSize',15)

    xlim([x_lim(1) x_lim(2)])
    ylim([y_lim(1) y_lim(2)])
    xticks([0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5])
    yticks([0 0.4 0.8 1.2 1.6 2 2.4])
    set(gca, 'FontSize', 30);
    set(gca,'TickLabelInterpreter', 'Latex');

leg=legend(['$\lambda/H_{1}=\infty$'],...
['$\lambda/H_{1}=19.2$'],...
['$\lambda/H_{1}=12.9$'],...
['$\lambda/H_{1}=9.2$'],...
['$\lambda/H_{1}=8.5$'],...
['$\lambda/H_{1}=6.9$'],...
['$\lambda/H_{1}=5.8$'],...
['$Dimotakis \; (1991)$']);
set(leg,'Interpreter','Latex','Fontsize',20);

% position légende
% exemple pos_leg =[x y width, height];
pos_leg = [0.765, 0.325, .1, .18];
set(leg, 'Position', pos_leg)


