I am trying to obtain slab-waveguide dispersion plot like this (dashed line):
I tried following code in Matlab:
function main
fimplicit (@(x,y)f(x,y),[0 10])
end
function fun = f(x,y)
nc=1.45; %cladding
nf=1.5;
ns=1.4; %substrate
h=5; %width of waveguide
beta=sqrt(x^2*nf^2-y.^2);
gammas=sqrt(beta.^2-x^2*ns^2);
gammac=sqrt(beta.^2-x^2*nc^2);
z=sin(h*y);
%TE mode
fun=z-cos(h*y)*(gammac+gammas)./(y-gammas.*gammac./y);
end
Using Desmos:
Using Mathematica:
nc = 1.45;
nf = 1.5;
ns = 1.4;
h = 5;
ContourPlot[
Sin[h y]*(y^2 - (Sqrt[x^2*(nf^2 - nc^2) - y^2]*
Sqrt[x^2*(nf^2 - ns^2) - y^2])) ==
Cos[h y]*(Sqrt[x^2*(nf^2 - nc^2) - y^2] +
Sqrt[x^2*(nf^2 - ns^2) - y^2])*y, {x, 0, 10}, {y, 0.1, 10}]
All the plots are in excellent agreement with form expected. However the original plot has a different color for each branch, how can I implement this in MatLab, Desmos or Mathematica ?
f(x,y)=c
), is it so? With the equations, it is easier to modify the code to plot each curve with a different color. – Thales Dec 10 '19 at 10:34