Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Amplitude from FFT of real data

paul_brown
Beginner
468 Views

Hi,

As I've mentioned in myprevious (first)post, I'm developing an application which is taking in data from various sensors at 100Hz, looking to identify dominant frequencies which might indicate vibration. I'm currently testing my implementation with input of a known value, currently for the sake of this example a 4Hz 700mV sine wave with a 500mV DC offset.

I'm using a sample size of 2048, and applying a Hann window before applying the FFT, using the IPP_FFT_DIV_FWD_BY_N in the InitAlloc specification. I'm displaying the first 20Hz worth of the FFT in an XY Plot in what I hope is amplitude against frequency on the X axis. Now the frequency is displaying spot on, but my amplitude values are nonsensical

I'm calculating amplitude from the FFT as the magnitude divided by the number of samples, then multiplying all but bin zero by 2. I haven't as yet attempted to apply a correction for the coherent gain loss caused by using the Hann window, but I would still expect to see values for Amplitude in the region of 350 mV, what I do get is a value in the region of 3mV, which is disappointing to say the least. I've tried using both the ipps magnitude function and calculating the value directly for each bin ie the squareof the real part + the square of the imaginary part, take the square root of this to generate the magnitude.

I'm hoping that someone here is going to read this far then tell me what exactly I've done wrong, or failing that, where my assumptions regarding amplitude and magnitude are incorrect. In case anyone is wondering, the reason I'm interested in amplitudes being reasonably accurate is that I will eventually be working in engineering units for the various sensors, and while the user may not pick up on an incorrect voltage (though I really would expect them to notice the discrepency between 3 & 350mV!) they will notice if say the torque or pressure values are not in the expected ranges.

Any help would be most appreciated, I know I must be something stupid, but I can't see where.

0 Kudos
2 Replies
andrewk88
Beginner
468 Views

Hi Paul,

I'd suggest you go step by step with your work and tryto practicewith some artificial signals first e.g. harmonic tones produced by the ippsTone_Direct_32f() where you can freely set-up their ampltudes and frequencies. Then transform these signals using some forward ffts and inverse ffts to get them exactly back. If you're using 1D signals that should be straightforward. Please note there arevarious (but very similiar) formats of fft transformed data. Please also pay attention to and experiment a little with the normalization factors. Personally, I spenta lot of timeto understand internalsof the 2D FFTs and also have managed to successfully use the ippsMagnitude() calls (btw kindly introduced for my request). I agree that in many places IPP documentation is too general that's why you need to do your own homework.

Sorry for not being not more specific. If you could provide me with some more code details I could try to help.

Best regards,

AndrewK

0 Kudos
paul_brown
Beginner
468 Views

Andrew,

Solid advice, and in fact, that was what I was doing when I found my error this morning. I'd mis-sized the array for the CCS packed FFT, so the conversion to complex array was generating some very strange results. Correcting this gave me much more sensible data, and now I'm perfectly happy with both the frequency & amplitude results I'm getting from my test signals. Sorry to have taken your time on an essentially self-inflicted problem, but thanks for the quick reply.

Regards,

Paul

0 Kudos
Reply