Why does my index exceed array bounds for the following for loop?
1 回表示 (過去 30 日間)
古いコメントを表示
lamda = 0:500; %s^-1
mewp = .012; %Poise
for i = 1:length(lamda)
mewapp = mewp(2.3409.*lamda(i) + 6.12.*sqrt(lamda(i))+4);
figure(1)
hold on
plot (lamda(i),mewapp);
end
error message
Index exceeds array bounds.
Error in Problem3_b (line 4)
mewapp = mewp(2.3409.*lamda(i) + 6.12.*sqrt(lamda(i))+4);
0 件のコメント
回答 (1 件)
madhan ravi
2019 年 2 月 15 日
You don’t need a loop
mewp*
% ^-—-—-missed it
1 件のコメント
madhan ravi
2019 年 2 月 15 日
lamda = 0:500; %s^-1
mewp = .012; %Poise
mewapp = mewp*(2.3409*lamda + 6.12*sqrt(lamda)+4);
plot (lamda,mewapp)
If you want to see the movement of the plot:
figure
comet(lamda,mewapp)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!