MATLAB数组索引出错。

10 views (last 30 days)
sanfqpu
sanfqpu on 22 May 2023
Answered: pfuhtac on 22 May 2023
请问这是哪错了,只能运行到i=0.6。i=0.7就报错了
HPM3=zeros(1,30001);
HGM3=zeros(1,30001);
for i=0:0.1:3000
A2=2*pi*L1*(fr^2-i^2)*(i^2-f0*tan(PM)*((f0*10^(TF0/20))^2-i^2)^0.5);
B2=(Ginv)*i*(i^2*tan(PM)+f0*((f0*10^(TF0/20))^2-i^2)^0.5);
HPM2=A2/B2;
HGM2=(2*pi*L1*i*10^(GM/20))/Ginv;
a=10*i+1;
HPM3(1,a)=HPM2;
HGM3(1,a)=HGM2;
end
位置 2 处的索引无效。数组索引必须为正整数或逻辑值。
出错 stableregion (第 44 行)
HPM3(1,a)=HPM2;

Accepted Answer

pfuhtac
pfuhtac on 22 May 2023
仅供参考
a=10*i+1;
改为
a=round(10*i+1);

More Answers (0)

Categories

Find more on 启动和关闭 in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!