不喜勿喷,本人很久没写代码了,随便找点东西练一下手。网上有看到使用Python实现的,懒得装乱七八糟的东西,就拿MATLAB写了一遍,代码及说明如下。
clear all;
%This code help you to calculate the cutoff wavelength in a rectangular
%waveguide and give you the order of the modes.
% Here, you need to input rectangular waveguide's a and b, the default figure use WR90's.
% Do remember that the value of a is bigger than b;
% a=20.86;
% b=10.12;
a=input('Please input the value of a:');
b=input('Please input the value of b:');
%Here you can choose how many modes you may need.
for i = 0:2 %According to the number you have chosen
for j = 0:2 %According to the number you have chosen
if i == 0 & j == 0 %TE00 mode is not exist.
else
lambda(i+1,j+1) = 2/sqrt((i/a)^2+(j/b)^2);
lam(i*3+j)=2/sqrt((i/a)^2+(j/b)^2); %According to the number you have chosen
end
end
end
lam=sort(lam); %Now the length of this array is eight.
for k = 1:8
for i = 0:2
for j = 0:2
if

这篇博客分享了一段MATLAB代码,用于计算矩形波导模式。博主久未编写代码,以此作为练习,并指出相比于Python实现,他选择了MATLAB进行编写。
最低0.47元/天 解锁文章
552

被折叠的 条评论
为什么被折叠?



