⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fiber.m

📁 强大的计算电磁场本征函数与本征模的程序
💻 M
字号:
function [x,y,xc,yc,nx,ny,eps] = fiber(n,r,side,dx,dy);

% This function creates an index mesh for the finite-difference
% mode solver.  The function will accommodate a generalized three
% layer rib waveguide structure.  (Note: channel waveguides can
% also be treated by selecting the parameters appropriately.) 
% 
% USAGE:
% 
% [x,y,xc,yc,nx,ny,eps] = fiber(n,r,side,dx,dy)
%
% INPUT
%
% n - indices of refraction for layers in fiber
% r - outer radius of each layer
% side - width of cladding layer to simulate
% dx - horizontal grid spacing
% dy - vertical grid spacing
% 
% OUTPUT
% 
% x,y - vectors specifying mesh coordinates
% xc,yc - vectors specifying grid-center coordinates
% nx,ny - size of index mesh
% eps - index mesh (n^2)
%
% AUTHOR:  Thomas E. Murphy (tem@umd.edu)

nx = round((sum(r)+side)/dx);
ny = round((sum(r)+side)/dy);

xc = (1:nx)'*dx - dx/2;
yc = (1:ny)*dy - dy/2;
x = (0:nx)'*dx;
y = (0:ny)*dy;

rho = sqrt(xc.^2*ones(size(yc)) + ones(size(xc))*yc.^2);

nlayers = length(n);
eps = n(nlayers).^2*ones(nx,ny);

for jj = (nlayers-1):-1:1,
  kv = find(rho < r(jj));
  eps(kv) = n(jj).^2;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -