MATLAB数组索引出错。

12 Ansichten (letzte 30 Tage)
sanfqpu
sanfqpu am 22 Mai 2023
Beantwortet: pfuhtac am 22 Mai 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;

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu 启动和关闭 finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!