forming table from function call
2 次查看(过去 30 天)
显示 更早的评论
la0 = 650; k0 = 2*pi/la0; a = 100/2;
ef = 1; ec = -19.6224 - 0.443*j; % set ec = -16.6224
pc = ef/ec; tol = 1e-12;
q = (0:3)’; m=0; % set m=0,1 for even or odd modes
ga1 = 1/k0/a*atanh(-pc) - j*pi/2/a/k0*(m+2*q);
ga2 = 1/k0/a*atanh(-pc) + j*pi/2/a/k0*(m+2*q);
gin = [ga1.’; ga2.’]; gin = gin(:); % list them as -/+ pairs
q = [q’;q’]; q = q(:);
gin(1)=[]; q(1)=[]; % eliminate duplicate q=0 case
bin = sqrt(gin.^2 + ef); % initial search vector
be = pwg(la0,ef,ec,a,bin,m,tol); % solution vector for beta
ga = sqrt(be.^2 - ef); ac = sqrt(be.^2 - ec); % gamma and alpha_c vectors
E = norm(pc*ac + ga.*tanh(ga*k0*a + j*m*pi/2)) % computational error norm
num2str([be,ga,ac],’%12.6f’) % table
pl form the table from the following program
2 个评论
Kevin Holly
2022-2-2
la0 = 650; k0 = 2*pi/la0; a = 100/2;
ef = 1; ec = -19.6224 - 0.443*j; % set ec = -16.6224
pc = ef/ec; tol = 1e-12;
q = (0:3)'; m=0; % set m=0,1 for even or odd modes
ga1 = 1/k0/a*atanh(-pc) - j*pi/2/a/k0*(m+2*q);
ga2 = 1/k0/a*atanh(-pc) + j*pi/2/a/k0*(m+2*q);
gin = [ga1.'; ga2.']; gin = gin(:); % list them as -/+ pairs
q = [q';q']; q = q(:);
gin(1)=[]; q(1)=[]; % eliminate duplicate q=0 case
bin = sqrt(gin.^2 + ef); % initial search vector
be = pwg(la0,ef,ec,a,bin,m,tol); % solution vector for beta
ga = sqrt(be.^2 - ef); ac = sqrt(be.^2 - ec); % gamma and alpha_c vectors
E = norm(pc*ac + ga.*tanh(ga*k0*a + j*m*pi/2)) % computational error norm
num2str([be,ga,ac],'%12.6f') % table
Do you have the function pwg?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gamma Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!