www.pudn.com > waveguide_dispersion.zip > neff.m, change:2011-12-13,size:442b


function n_=neff(n1,n2,n3,d,wl) 
clc; 
k=2*pi./wl; 
N=10000; 
jd=10^(-6);   %精度 
bt=n2.*k:(n1-n2).*k/N:n1.*k; 
 m=0;  %取100个模式 
for i=1:N 
a=bt(i); 
x=i+1; 
b=bt(x); 
fa=fun(n1,n2,n3,k,d,a,m); 
fb=fun(n1,n2,n3,k,d,b,m); 
if fa.*fb<=0; 
c=(a+b)/2; 
fc=fun(n1,n2,n3,k,d,c,m); 
while abs(fc)>=jd; 
if fa.*fc>=0; 
    fa=fc; 
    a=c; 
else fb=fc; 
    b=c; 
end 
c=(a+b)/2; 
fc=fun(n1,n2,n3,k,d,c,m); 
end 
n_=c./k; 
 
else  
end 
end 
end