Index exceeds the number of array elements (3).
1 回表示 (過去 30 日間)
古いコメントを表示
I'm getting an error with the linspace i have created. im trying to calculate 'TLab'
the error im getting is 'Index exceeds the number of array elements (3).
Error in labmaterials (line 76)
Ms(iii)=2/pi*(w1*log(tan(acos(w1/l_vector(iii)))+l_vector(iii)/w1)+l_vector(iii)*(pi/2)-l_vector(iii)*acos(w1/l_vector(iii)));
this is my code
dpag=linspace(0,3,1000);
for iii =[1:1000]
d=dpag(iii);
Ms(iii)=2/pi*(w1*log(tan(acos(w1/l_vector(iii)))+l_vector(iii)/w1)+l_vector(iii)*(pi/2)-l_vector(iii)*acos(w1/l_vector(iii)));
TLab(iii)=a2*u*b/Ms(iii);
Yield2(iii)=M*Ty1(iii);
end
回答 (1 件)
Sindhu Karri
2020 年 11 月 26 日
Hii,
According to my understanding the error 'Index exceeds the number of array elements (3)' is because of using an array (probably l_vector)of size 3 inside for loop which runs 1000 times trying to access out of bound array elements.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!