%set structure lrow=200; lcol=100; n=ones(lcol,lrow); lx=1.5; ly=lx/lcol*lrow; [x,y]=meshgrid(linspace(0,lx,lrow),linspace(0,ly,lcol)); i=find(y<=1.5); n(i)=1.5; %glass i=find(y>1.5 & y<1.8 & x<0.5); n(i)=2; i=find(y>1.25 & y<1.5); n(i)=2; %set waveguide wg=waveguide; lambda=0.8; index=n; wg=set_prop(wg,lambda,lx,ly,index) %calculate modes guess=max(n(:)); [neff,er,ec]=fvms(wg,'0S00',2,guess); neff figure(1); pcolor(er(:,:,2));shading interp; figure(3); pcolor(ec(:,:,2));shading interp; return guess=max(n(:)); [neff,phi]=svms(wg,'0S00',2,guess,'HR'); neff pcolor(phi(:,:,2));shading interp; return; %calculate modes guess=max(n(:)); [neff,phi]=sms(wg,'0S00',1,guess); neff pcolor(phi(:,:,1));shading interp; return;