Effacer les filtres
Effacer les filtres

Increasing time intervals with for loop

2 vues (au cours des 30 derniers jours)
heewon Yang
heewon Yang le 2 Mai 2020
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???

Réponses (1)

Olawale Ikuyajolu
Olawale Ikuyajolu le 2 Mai 2020
Modifié(e) : Olawale Ikuyajolu le 2 Mai 2020
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.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by