06-02-2017 02:50 PM
I have created 2 separate programs that I want to generate the same result. The first program (whileloop2) generates a sine waveform, performs FFT, and displays it on a graph all under the while loop and outputs the correct result. The second program (whileloop3) generates a sine waveform and sends the array values of the waveform outside the while loop, then builds a waveform and performs FFT outside the while loops and displays it on a graph. The second program is not outputting the same results and i am not sure why. Does anyone know the reason for this and how to fix it? I need to be able to perform the fft outside the while loop correctly for another program that generates values from hardware. Please let me know, thanks.
06-02-2017 02:56 PM
at the very least your are specifying the wrong "dt".
The "dt" in the waveform must be the reciprocal of the sample rate.
Ben
06-02-2017 03:01 PM
So if i set my frequency to .1 Hertz, what should i set my sample rate at?
06-02-2017 03:06 PM
@loudoe77 wrote:
So if i set my frequency to .1 Hertz, what should i set my sample rate at?
Errrr... 0.1 ?
dt is the reciprocal.
Ben
06-02-2017 08:23 PM
@loudoe77 wrote:
So if i set my frequency to .1 Hertz, what should i set my sample rate at?
Fs = Sample Rate = 0.1
Ts = dt = 10
dt is the time between samples and the math is just dt = 1/Fs