How to generate a since wave at a specific irregular interval?
1 view (last 30 days)
Show older comments
Hi Guys
I would like to schedule a sine wave at a specific irregular interval. Can anyone help me with this? (i.e. 0-8.5 is constant flat at 0, 8.5-11.5 sine wave, 11.5-12 constant 0. etc..) Thanks in advance!
0 Comments
Answers (1)
Walter Roberson
on 4 Oct 2015
Edited: Walter Roberson
on 4 Oct 2015
notes = @(F,t)sin(8*F*2*pi*(0:1/11025:t-1/11025));
This is designed for 11025 Hz; if you want a different frequency then change the number.
Invoke with a frequency and a duration in seconds. You can use frequency 0 for an all 0 output.
Change a bunch of these together:
T = [notes(0,8.5), notes(440,3.5), notes(0, 0.5), ...];
You can then sound() the result, passing in the frequency as well:
sound(T, 11025);
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!