how can i create an endlesse animation of sine wave

3 views (last 30 days)
hi friends,
how can i write a matlab script wich creates an endeless animation of sine wave whose amplitudes varies from on to zero then from zero to one and so on. The frequency of the sine wave is 10Hz, th length of the time support for the plot must be one seconde, and i should try different pause times.
thanks in advance.

Accepted Answer

Walter Roberson
Walter Roberson on 7 Jan 2016
You would adjust the parameters at the very top of the code, and you would change the "for" to produce values for H0 instead of H1, and you would comment out the assignment of H1 into f()
  4 Comments
Mourchid
Mourchid on 7 Jan 2016
Thanks a lot Mr.Walter for your answer, i have juste a little question, if frequency varies linearly over time between 0Hz and 200Hz, with a frequency steps size equal to 5Hz and the length of the time support for the plot must be one second, how can i create this endlesse animation of a sine wave with different pause times??
Walter Roberson
Walter Roberson on 7 Jan 2016
In the code in that posting, I always assign to the same index locations in the array f as that task involved constant frequencies. For the frequency to vary over time, you would assign to different locations in f.
If you want different pause times then change the pause() call to reflect the time you want to pause.

Sign in to comment.

More Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!