I am tying to achieve sine wave gradually changing from 8Hz
to 2Hz
over 5
seconds:
This waveform was produced in Cool Edit. I gave it a start frequency of 8Hz
, an end frequency of 2Hz
and a duration of 5
seconds. The sine wave gradually changes from one frequency to the other over the given time.
My question is, how can I accurately find the start time of each cycle (highlighted with a red dot), using a FOR loop?
Pseudo code:
time = 5 //Duration
freq1 = 8 //Start frequency
freq2 = 2 //End frequency
cycles = ( (freq1 + freq2) / 2 ) * time //Total number of cycles
for(i = 0; i < cycles; i++) {
/* Formula to find start time of each cycle */
}
phase=0
but I think the problem is to generate such signal not to find the zero crossings. It was just an rookie attempt to approach this by generating separate sin waves which is wrong for this. – Spektre