how to get the correct plot from this matlab code? correct plot is a gaussian type but i am getting a straight line.given (e1=1 and e2=0) or (e1=0 and e2=1)

i am writing the comlete code below.
e1=input('enter the value of ei1')
e2=input('enter the value of ei2')
w=1.5:0.01:1.6;
k1=0.25;
k2=0.25;
a=0.0005;
ne=2.5;
r=1.5*10^-6;
l=2*pi*r;
kn=(2*pi*ne*l)./w;
ed=e2*((sqrt(1-k2)-sqrt(1-k1)*exp(-a.*l-j*kn*l))./(1-sqrt(1-k1)*sqrt(1-k2)*exp(-a.*l-j*kn*l)))+e1*((-sqrt(k1-k2)*exp(a*l/2-(j*kn*l)/2))./(1-sqrt(1-k1)*sqrt(1-k2)*exp(-a.*l-j*kn*l)));
y=abs(ed);
z=y.^2; if true % code end plot(w,z)

回答(1 个)

Like I said in your duplicate post, it's not straight - it just looks that way like any curve will if you look over a small enough section of it.

类别

帮助中心File Exchange 中查找有关 Optics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by