ECF 1.5
PhotonicCrystal1D.m
1% see https://ocw.mit.edu/courses/materials-science-and-engineering/3-024-electronic-optical-and-magnetic-properties-of-materials-spring-2013/lecture-notes/MIT3_024S13_2012lec23.pdf
2clear all; close all; clc;
3cols={[0.1216 0.2275 0.5765]} ; % a nice line color
4
5% setup
6h1 = 2; % fractional thickness 1
7h2 = 1; % fractional thickness 2
8n1 = 1; % = sqrt(eps1)
9n2 = 3; % = sqrt(eps1)
10Nk0 = 1000; Nkz = 1000;
11k0 = linspace(0,8,Nk0);
12kz = linspace(-1,1,Nkz)*pi/(h1+h2);
13
14% definitions
15k1 = n1*k0;
16k2 = n2*k0;
17
18% dispersion equation (lengthy, general form)
19M11 = exp(-1i*k1*h1).*(cos(k2*h2)-0.5*1i*(k1./k2+k2./k1).*sin(k2*h2));
20M22 = exp(1i*k1*h1).*(cos(k2*h2)+0.5*1i*(k1./k2+k2./k1).*sin(k2*h2));
21f = bsxfun(@minus, cos(kz*(h1+h2)), (M11 +M22).'/2);
22
23% analytical solution
24kza = real(acos(cos(k1*h1).*cos(k2*h2) - (n1^2+n2^2)/(2*n1*n2)*sin(k1*h1).*sin(k2*h2)));
25% nasty fix for visualization purposes - only care about real part above zero
26kza(abs(kza)<1e-9) = NaN;
27
28
29% --- figure ---
30set_figsize(1,10,17)
31% visualize the "dispersion equation" magnitude - black where solutions exist
32pcolor(kz*(h1+h2),k0,-log(abs(f))); shading interp
33caxis([0.01,3])
34colormap(flipud(gray))
35hold on
36plot([0,0],minmax(k0),'-k') % axis line
37% analytical solution of K as function of Omega
38plot(real(kza),k0,'--','color',cols{1},'linewidth',3);
39plot(-real(kza),k0,'--','color',cols{1},'linewidth',3);
40%tidy up
41hold off
42box on; set(gca,'Layer','Top')
43xlabel('\itk_xa','Fontsize',12)
44ylabel('\it\omega\ita/c','Fontsize',12)
45
46
47
48