Access FFT bin complex values

Status
Not open for further replies.
But i read somewhere by averaging complex spectrum can avoid noises. This is going to be a DSP problem then. My approach is wrong. Are you sure about that?? :eek:
 
Last edited:
But i read somewhere by averaging complex spectrum can avoid noises. This is going to be a DSP problem then. My approach is wrong then. Are you sure about that?? :eek:

doing FFT is equivalent to a bank of narrow filters, you can do hardly better than that. You could increase your FFT size, but this requires that the signal is stationary within the FFT size, which is typically not the case in biological systems.

If you know the signal (amplitude and phase) you could also do a matched filter, that gives you the energy of the signal, and suppresses noise (keyword: gain = time-bandwith product). otherwise for broadband signals with unknown amplitude and phase, you could use band-pass filters, removing out of band noise.

But again and FFT is already a bank of narrow-band filters.
 
Michael,
mind to elaborate?

buffer is declared as a int16_t. If you use a pointer to convert this to uint32_t, it may happen to work, depending on the whim of the compiler, the current machine, alignment, and maybe phase of the moon, etc. However, it is outside the scope of the ISO C/C++ standards if you convert a pointer from a smaller type to a larger type, except in the case of converting a subclass pointer to a superclass, assuming you are converting to the right superclass.

For example, without using the -fno-strict-aliasing kludge, the compiler might have optimized values for buffer and put them in registers, that haven't yet been stored, and doing the type punning, you might get an old value. This is because the compiler believes that outside of char each type is in a different storage class (because that is what ISO C/C++ say), and stores to one storage class might not affect other storage classes

In addition, on the Teensy, while unaligned addresses generally work (albeit slower than aligned addresses), there is one address at the end of the segment, that bad things happen if you access this value using a 32-bit memory reference. Now, Paul is presumably careful to run into these situations, but if you don't know the limitations, you can blindly go into uncharted territory.
 
doing FFT is equivalent to a bank of narrow filters, you can do hardly better than that. You could increase your FFT size, but this requires that the signal is stationary within the FFT size, which is typically not the case in biological systems.

If you know the signal (amplitude and phase) you could also do a matched filter, that gives you the energy of the signal, and suppresses noise (keyword: gain = time-bandwith product). otherwise for broadband signals with unknown amplitude and phase, you could use band-pass filters, removing out of band noise.

But again and FFT is already a bank of narrow-band filters.


Good points. Anyway could you please tell me how to take the magnitude of the fft bins in dB. (Bin maximum amplitude is 1)
 
Presumably, the 'u' got dropped somewhere in the multiple re-quotes, etc.

Could be - I didn't see the original source as it started :) But if there is a pointer to 16 bit data it should be used that way. The data seems to be alternate 2 byte values Real then Complex. I came in with code not parsing that cleanly, much clearer for compiler and all to read versus masking off 16 bits reading 32 bits at a time.
 
Status
Not open for further replies.
Back
Top