Combining results of two implicit function solutions

5 vues (au cours des 30 derniers jours)
Jihoon Kim
Jihoon Kim le 25 Mai 2018
Commenté : Jihoon Kim le 25 Mai 2018
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
clf
w=2,l=100,h=2;
nair=1, nf=2.5, nsub=1.45;
n1=nf;
n2=nsub;
n3=nair;n4=nair;n5=nair
kxeqn=@(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.

Réponse acceptée

Torsten
Torsten le 25 Mai 2018
For a given k0, use interp1 to interpolate kx(k0) and ky(k0). Then kz(k0)=k0^2-(kx(k0))^2-(ky(k0))^2.
For the interpolation, use MATLAB's "interp1".
Best wishes
Torsten.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by