Info
此问题已关闭。 请重新打开它进行编辑或回答。
I keep getting the error Subscript indices must either be real positive integers or logicals.
1 次查看(过去 30 天)
显示 更早的评论
theta=linspace(-pi,pi,500);
P=[269.2 15913 8964 2421];
E1=0.206;
Nth=length(theta), NP=length(P);
r1=zeros(Nth,NP);
for i=1:Nth
c=1-(E1*cos(theta(i)));
for j=1:NP
r1=(E1*P(j))/c;
end
end
0 个评论
回答(1 个)
Walter Roberson
2017-9-30
That code executes without difficulty for me. However you are overwriting all of r1 every iteration of j and every iteration of i. Perhaps you want
r1(i, j) = (E1*P(j))/c;
1 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!