矩形波导模式计算MATLAB代码

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

不喜勿喷,本人很久没写代码了,随便找点东西练一下手。网上有看到使用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 
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值