Advertisement
rgbanks1995

Bragg_reflect

Apr 23rd, 2020
1,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 3.13 KB | None | 0 0
  1. %Notes:
  2. clear all
  3. n_1=1;                              %Refractive index of air
  4. n_2=2.3;                            %Refractve index of zinc sulphite
  5. n_3=1.35;                           %Refractive index of cryolite
  6. n_l=1.5;                            %Refractive index of glass
  7. wav_0=500;                          %Bragg wavelength
  8. wavs=[390:1:700];                   %Visible spectrum that will examined
  9. N=[2 5 10 20];                      %Stacks that will be examined
  10. R=zeros(length(N),length(wavs));    %Matrix where reflectivity will be stored
  11.  
  12.  
  13. h_2=wav_0/(4*n_2);                  %Thickness for a layer of zinc sulphite
  14. h_3=wav_0/(4*n_3);                  %Thickness for a layer of cyrolite
  15. h=h_2+h_3;                          %Thickness of a stack
  16.  
  17. ang_n1=deg2rad(90);                 %Angle of incidence in degrees; 0 is normal incidence
  18. ang_n2=asin((sin(ang_n1)*n_1)/n_2); %Angle after refraction through zinc sulphite
  19. ang_n3=asin((sin(ang_n2)*n_2)/n_3); %Angle after refraction through cryolite
  20. ang_nl=asin((sin(ang_n3)*n_3)/n_l); %Angle after refraction through glass
  21.  
  22. p_1=n_1*cos(ang_n1);
  23. p_2=n_2*cos(ang_n2);
  24. p_3=n_3*cos(ang_n3);
  25. p_l=n_l*cos(ang_nl);
  26.  
  27. for j=1:4                           %For loop which tests with each no. of stacks
  28. for k=1:311                         %For loop which finds reflectivity for a given wavelength and no. of stacks
  29.  
  30.     b_2=((2*pi)/wavs(k))*p_2*h_2;
  31.     b_3=((2*pi)/wavs(k))*p_3*h_3;
  32.  
  33.     %a=cos(b_2)*cos(b_3)-0.5*((p_2/p_3)+(p_3/p_2))*sin(b_2)*sin(b_3)
  34.  
  35. %     u=zeros(1,N(j));
  36. % for o=1:N(j);
  37. %       u(1,o)=(sin((o-1)*acos(a)))/sqrt(1-a^2);
  38. % end
  39.  
  40. %     b_2=((2*pi)/wavs(k))*p_2*h_2;
  41. %     b_3=((2*pi)/wavs(k))*p_3*h_3;
  42.  
  43.     M_2=[cos(b_2) -i/p_2*sin(b_2);-i*p_2*sin(b_2) cos(b_2)];
  44.     % ^Characteristic matrix for a single layer of zinc sulphite
  45.     M_3=[cos(b_3) -i/p_3*sin(b_3);-i*p_3*sin(b_3) cos(b_3)];
  46.     % ^Characteristic matrix for a single layer of cyrolite
  47.     M_h=M_2*M_3;
  48.     % ^Characteristic matrix for zinc sulphite and cyrolite layers together
  49.     % (a "stack")
  50.     M_2N=M_h^N(j);
  51.     % ^Characteristic matrix for N pairs of zinc sulphite and cyrolite
  52.     % layers, where N is the number of stacks
  53.  
  54. %     M_2N(1,1)=M_h(1,1)*u(1,N)-u(1,N-1);
  55. %     M_2N(1,2)=M_h(1,2)*u(1,N);
  56. %     M_2N(2,1)=M_h(2,1)*u(1,N);
  57. %     M_2H(2,2)=M_h(2,2)*u(1,N)-u(1,N-1);
  58.  
  59.     r=((M_2N(1,1)+(M_2N(1,2)*p_l))*p_1-(M_2N(2,1)+(M_2N(2,2)*p_l)))/((M_2N(1,1)+(M_2N(1,2)*p_l))*p_1+(M_2N(2,1)+(M_2N(2,2)*p_l)));
  60.     % ^Reflection coefficient for N stacks
  61.     R(j,k)=abs(r^2);                %Reflectivity for the no. of stacks and wavelength
  62. end
  63. end
  64.  
  65. figure; hold on
  66. plot(wavs,R(1,:),'r-')
  67. plot(wavs,R(2,:),'b-')
  68. plot(wavs,R(3,:),'g-')
  69. plot(wavs,R(4,:),'y-')
  70. xlim([390 700])
  71. legend('No. of stacks = 2','No. of stacks = 5','No. of stacks = 10','No. of stacks = 20','location','northeast')
  72. xlabel('Wavelength (nm)')
  73. ylabel('Reflectance (dimensionless)')
  74. title('Reflectance of a Bragg reflector over the visible spectrum (Incidence = \pi/2 rad)')
  75.  
  76. %poly=[1 2*a 4*a^2-1 8*a^3-4*a 16*a^4-12*a^2+1 32*a^5-32*a^3+6*a];
  77. % u=zeros(1,2);
  78. % for i=1:N_2;
  79. %       u(1,i)=(sin(i*acos(a)))/sqrt(1-a^2);
  80. % end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement