Index exceeds the number of array elements in a while loop
显示 更早的评论
Hello everyone, I keep getting the classic error message of 'Index exceeds the number of array elements (169)'. Here is my code, it's a very simple while loop:
syms T h
T (h) = ((288.19-0.00649.*h));
h = linspace (7620,11000,169); %Every step is 20m change in altitude
D = vpa(T(h),4);
s = 1;
while s <= 169
rho(s) = 1.225*(D(h)/288.19)^((9.80665/(0.0065*286))-1);
s = s+1;
end
I really don't see where I've gone wrong. I have other while loops that follow the same structure and they work perfectly. Any help would be appreciated. Thanks in advance!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!