Storing values from a loop in an array
3 次查看(过去 30 天)
显示 更早的评论
Hi everyone!
I'm trying to run a loop that saves every value after every iteration until it reaches 0 at which point the loop ends.
My code is as follows:
for y = [y;]
if y>=0
dV_y = (dt/m)*((0.5*rho*C_D*S)-m*g);
dy = dV_y*dt;
y = y+dy;
end
end
The loop runs 1 time and doesn't save it as an array.
Any help will be greatly appreciated, thanks!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!