% Plotting NA of step index and graded index fibres
clear;clc;clf reset
sitil = ['-k  ';'--k ';':k  ';'-.k ';'--ok';':ok ';'-k  ';'--k ';':k  '];linwid = [2 3 3 2 2 2 1 2 2];
n1 = 1.485;n2 = 1.47;rnor = 0:0.1:1;psiarr = pi/2:-0.5:0;NA_si = [];NA_gi = [];
delta2 = 0.5*(n1^2 - n2^2)/n1^2;q = 2.3;
for ip = 1:length(psiarr)
    psi = psiarr(ip);
    psi1 = acos(-rnor*cos(psi)) + psi;
NA_sir = sqrt(n1^2 - n2^2)*sqrt(1 + (rnor.*sin(psi1)./(1 + rnor.*cos(psi1))).^2);
NA_gir = sqrt((n1^2 - 2*n1^2*delta2*rnor.^q - n2^2)./(1 - rnor.*((cos(psi))^2)));
NA_si = [NA_si;NA_sir];NA_gi = [NA_gi;NA_gir];%end
figure(1)
plot(rnor,NA_sir,sitil(ip,:),'LineWidth',linwid(ip));hold on;set(gcf,'Color',[1 1 1]);set(gca,'FontSize',16)
figure(2)
plot(rnor,NA_gir,sitil(ip,:),'LineWidth',linwid(ip));hold on;set(gcf,'Color',[1 1 1]);set(gca,'FontSize',16)
end

hold off;set(gca,'FontSize',16)
xlabel('Normalized radial distance ','FontSize',14,'FontWeight','bold');
ylabel('Numerical aperture ','FontSize',14,'FontWeight','bold')
