Hello all, I'm trying to obtain the relationship between two variables kz and k. kz is given by k^2-kx^2-ky^2, and since kx and ky are function of k, it is possible in principle to solve the problem. The problem is that I get one set of data, [k, kx] and another set of data[k,ky], and the lengths of the pairs do not match up at all. kx and ky are not analytic functions of k, so I had to use implicit function If I can somehow merge the two data, that would be the end of a story… below is my code
%w,l,h are dimensions of dielectric waveguide
%nair=air, nf=GaSe, nsub=SiO2
%lambda is laser wavelength
%k is wavevector
clfw=2,l=100,h=2;nair=1, nf=2.5, nsub=1.45;n1=nf;n2=nsub;n3=nair;n4=nair;n5=nairkxeqn=@(n,k,kx) kx-1/w*(n*pi-atan(kx/sqrt(k.^2-n3/n1*k.^2-kx.^2))-atan(kx/(sqrt(k.^2-n5/n1*k.^2-kx.^2))))kyeqm=@(m,k,ky) ky-1/w*(m*pi-atan(sqrt(n2^2/n1^2)*ky/sqrt(k.^2-n2/n1*k.^2-ky.^2))-atan((n4^2/n1.^2)*ky/(sqrt(k.^2-n4/n1*k.^2-ky.^2))))kyeq = @(k,ky) kyeqm(2, k,ky);kxeq= @(k,kx) kxeqn(1,k,kx);kydata=fimplicit(kyeq,[0 100])k1data=get(kydata,'xdata');ydata=get(kydata, 'ydata');kxeqkfix= @(kx) kxeqn(1,k1data,kx);kxdata=fimplicit(kxeq,[0 100]);k2data=get(kxdata,'xdata');xdata=get(kxdata,'ydata');
I'm pretty sure there's a better way to do it than mine, since all the textbooks do it very easily. Merging two data is fine, but if you have any other suggestions, I'm totally open to it.
Best Answer