Creating a loop and loop variable
조회 수: 2 (최근 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.
Yusuf Suer Erdem
2021년 12월 7일
maybe used i as a character. i changed it with a. it should be okey now.
추가 답변 (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!