Creating a loop and loop variable
1 次查看(过去 30 天)
显示 更早的评论
Hi guys,
How would I write a for loop in which the loop variable runs from 0 to pi/2 in steps of 0.01?
Am i right in saying:
for
A = 0:0.01:pi/2
end
Is this correct?
采纳的回答
Yusuf Suer Erdem
2021-12-7
编辑:Yusuf Suer Erdem
2021-12-7
for a=0:a+0.01:pi/2
disp(a)
end
4 个评论
Stephen23
2021-12-7
The colon operation given in the answer uses the imaginary unit in the step, which leads to this warning:
0:i+0.01:pi/2
I don't see any reason why the step needs to use the imaginary unit.
更多回答(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!