필터 지우기
필터 지우기

Increasing time intervals with for loop

조회 수: 2 (최근 30일)
heewon Yang
heewon Yang 2020년 5월 2일
편집: Olawale Ikuyajolu 2020년 5월 2일
Hi I have this code
Time = 0 : 0.001 : (6*pi);
function1 = sin(Time);
I want that initial interval value to increase and also change the function.
means,
0.001 -> 0.002 -> 0.003 .... -> 0.01
using for loop
Can anyone help with this???

답변 (1개)

Olawale Ikuyajolu
Olawale Ikuyajolu 2020년 5월 2일
편집: Olawale Ikuyajolu 2020년 5월 2일
Try using a while loop
time = 0
dt = 0.001
n = 1
while time <= 6*pi
function1 = sin(time)
time = time + (n) 0.001
n = n +1
end
you cant have changing intervals in that format.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by