load('Figure3-5.mat');

% histogram of wave normal & azimuthal angle of k
f1=figure(1);
set(gcf,'Position',[250,150,1600,700])

s11=subplot(1,2,1);
valued=find((log10(B_str)>-3.75 | log10(E_str)>-2.75) & Plan_3B3E>0.75 & ...
    log10(B_str)<5 & log10(E_str)<5);
histogram(Wave_3B3E(valued),36,'BinEdges',0:10:180);
hold on;
quan_wna = quantile(Wave_3B3E(valued),3);
line([quan_wna(1) quan_wna(1)],ylim,'Color','m','Linestyle','--','Linewidth',1.5);
line([quan_wna(2) quan_wna(2)],ylim,'Color','m','Linestyle','--','Linewidth',1.5);
line([quan_wna(3) quan_wna(3)],ylim,'Color','m','Linestyle','--','Linewidth',1.5);
text(-35,12000,'(a)','FontSize',18)
xlim([0 180])
xticks([0 30 60 90 120 150 180])
set(gca,'TickDir','out')
xlabel('\theta_k (°)','Fontsize',20)
ylabel('Number of signal pulses','Fontsize',20)
title('Polar angle of k vector','Fontsize',20)
set(gca,'FontSize',15)
clear quan_wna

s12=subplot(1,2,2)
valued=find((log10(B_str)>-3.75 | log10(E_str)>-2.75) & Plan_3B3E>0.75 & ...
    log10(B_str)<5 & log10(E_str)<5 & Wave_3B3E<160 & Wave_3B3E>20);
histogram(Azmu_3B3E(valued),36,'BinEdges',-180:10:180);
hold on;
quan_azmu = quantile(Azmu_3B3E(valued),3);
line([quan_azmu(1) quan_azmu(1)],ylim,'Color','m','Linestyle','--','Linewidth',1.5);
line([quan_azmu(2) quan_azmu(2)],ylim,'Color','m','Linestyle','--','Linewidth',1.5);
line([quan_azmu(3) quan_azmu(3)],ylim,'Color','m','Linestyle','--','Linewidth',1.5);
text(-250,9000,'(b)','FontSize',18)
xlim([-180 180])
xticks([-180 -135 -90 -45 0 45 90 135 180])
set(gca,'TickDir','out')
xlabel('\phi_k (°)','Fontsize',20)
ylabel('Number of signal pulses','Fontsize',20)
title('Azimuthal angle of k vector','Fontsize',20)
set(gca,'FontSize',15)
clear quan_azmu

s11.Position=[0.09 0.11 0.39 0.815];
s12.Position=[0.59 0.11 0.39 0.815];