Plane wave expansion method: Difference between revisions

Content deleted Content added
Mgaak (talk | contribs)
Example code: small mistake in code, in line 42 it should be sin not sinc
KIAaze (talk | contribs)
corrected the kn terms (sinc() instead or sin()) + added indent to show Kz for loop more clearly
Line 85:
freqs=[];
for Kz=-pi/a:pi/(10*a):+pi/a
Q=zeros(2*Mmax + 1);
for x=1:2*Mmax+1
for y=1:2*Mmax+1
X=x-Mmax;
Y=y-Mmax;
kn=(1 -1/eps_r)*d_over_a.*sinsinc((X-Y).*d_over_a) + ((X-Y)==0)*1/eps_r;
Q(x,y)=(2*pi*Y/a + Kz).^2*kn;
end
end
end
fprintf('Kz = %g\n',Kz)
 
omega_c=eig(Q);
fprintf('Kz = %g\n',Kz)
omega_c=eigsort(Qsqrt(omega_c));%important step.
freqs=[freqs; omega_c.'];
omega_c=sort(sqrt(omega_c));%important step.
freqs=[freqs; omega_c.'];
end