MATLAB数组索引出错。

10 次查看(过去 30 天)
sanfqpu
sanfqpu 2023-5-22
回答: pfuhtac 2023-5-22
请问这是哪错了,只能运行到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;

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 启动和关闭 的更多信息

Community Treasure Hunt

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

Start Hunting!