-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of multiple FFT's using the same code #51
Comments
It is possible to do so. My guess is that you are not resetting the vImag array back to zero before computing the second signal. Line 67 of the example FFT_01 states that not resetting it to zero leads to wrong results. |
I have used two different sets and also have reset vImag to zero. But still, the second FFT gives random values. I have attached the code for your reference. Kindly look into it and let me know if there is any mistake. |
I have used two different sets and also have reset vImag to zero. But still, the second FFT gives random values. I have attached the code for your reference. Kindly look into it and let me know if there is any mistake. https://github.com/kosme/arduinoFFT/files/4869138/FFT.code.docx |
@kosme Case 1: initialize two different objects outside the Void main() and void loop(), one for 4096 samples FFT and another object for 512 samples FFT float vReal_temp[4096]; ArduinoFFT FFT = ArduinoFFT(vReal1, vImag1, 4096, 500, weighingFactors); float vReal2[512]; void loop() microseconds = micros(); FFT.windowing(FFTWindow::Hann, FFTDirection::Forward); for(int i=0; i<512; i++) In this case, first i compute the fast Fourier transform using the object "FFT". It works well. after that i compute Fourier transform using the second object FFT1. But FFT1 simply prints some random values. Please note that the real and imaginary vectors of two different object FFT an FFT1 are completely different. Also, i am making sure that the imaginary vector is initialized to zero before i compute the FFTs Case 2: I declare the FFT object every time the loop executes and initialize the object with different vector size void loop() for(int i=0; i<512; i++) In this scenario also, i am getting some random value for second FFT calculation. I am not sure why, for first FFT calculation everything is perfect but for subsequent FFT calculation either by separate objects or same object it is printing some random values. Your advice or suggestion is highly appreciated. |
Hello,
I have written a code that reads two signals from two ADC. One signal is captured for 4096 samples and another signal is captured for 512 samples. I am sampling both the signals at 500 Hz.
I initially compute FFT for the signal with 4096 samples and find out the peak frequency. This works perfectly.
When I compute the FFT for the second signal, it gives me random values. I have created separate objects for both the FFT's. Kindly let me know if this is possible or should I destruct the first FFT before running the second one. If that's the case, kindly let me know the syntax for the destruct function.
The text was updated successfully, but these errors were encountered: