当前位置:   article > 正文

矩形波导TM11模matlab仿真_tm11模解析表达式

tm11模解析表达式

TM11

仅供参考嗷!!

clc;
clear;

count = input(‘迭代次数:’);%迭代次数
w = 2/(1+sin(pi/(count-1)));%收敛因子
h = pi/7;a = pi/11;%矩形波导尺寸
xa = input(‘单边节点数:’);%单边节点

tol = 10e-3;

%初始化
u=zeros(xa,xa);

%内点赋值
for i = 2:(xa - 1)
for j = 2:(xa - 1)
u(i , j) = 1;
end
end

%边界赋值
u(1,:) = 0; u(xa,:)= 0;
u(:,1) = 0; u(:,xa)= 0;

%kc初始化
kc = 0.1;

%迭代初始化
k = 0;
sum1 = 0; sum2 = 0; sum = 0;

%差分(超松弛)
while k < count
err = 0;
temp = u(i,j);
for i = 2 : xa - 1
for j = 2: xa - 1
u(i,j)=u(i,j)+w*((((u(i+1,j)+u(i,j+1)+u(i-1,j)+u(i,j-1)))/(4-(kc*h)^2))-u(i,j));
err = err + abs(temp - u(i,j));
end
end
k = k + 1;

%对kc进行迭代
for i = 2: xa-1
for j = 2 : xa-1
sum1 = sum1 + u(i,j)(u(i+1,j)+u(i,j+1)+u(i-1,j)+u(i,j-1)-4u(i,j));
sum2 = sum2 + u(i,j)^2;
end
end
kc = (sqrt(-sum1/sum2))/h;
%保证精确度
if(err<tol)
break
end
end

surf(u);
title(‘TM11’);

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/752209
推荐阅读
相关标签
  

闽ICP备14008679号