Adafruit_ZeroFFT
Adafruit_ZeroFFT copied to clipboard
Only real part is present
Hello, Thank you for the usefull library! i'm using your FFT library to realize a spectrum analyzer. For testing i connect a 150mVpp sinusoidal wave with a 500mV DC value to Arduino SAMD21 DAC A0 and select 1V reference voltage.
The software is doing this:
- ACQUIRE 256 sample
- REMOVE AVERAGE
- ZEROFFT
- Output the fft vector
- Restart
ISSUE: The amplitude of the BIN relative to the central frequency of the sine was oscillating between ZERO and a correct value at every different acquisition
ANALISYS: I retrive the acquired samples from the serial port and analized with matlab. i compared a 256 samples that show 359 as max fft bin value and 256 samples that show 11 as max fft bin value. Both signal has the same VPP anc VDC. the only difference is the phase... using matlab FFT i plot two different procedure:
- FFT(ABS(SIGNAL)
- FFT(ABS(REAL(SIGNAL))
The first one show me the correct spectrum and the second one show me the same value as ZEROFFT.
CONCLUSION: Looking at the code i see that the imaginary value are discarded and only the ABS of the real part is performed. I think that a correct ABS of complex number should performed as SQRT(REAL^2+IMG^2). An alternative solution could be to output both real and img parts.
Thank you for your great work.