Hi Andrew and redbird,
I did some 'brainstorming' last night, luckily not all night.
Coming back to the FFT priciple:
- from the mathematical point of view the, the imaginary samples are necessary in the FFT algorithm in agraham's library .
- from the user's point of view, almost all calculations are done with physical signals without any imaginary component.
In redbirds example:
- today he has 4096 real samples from his physical signal
- he needs to create an array with 4096 zeros for the imaginary part (with no use other than to satisfy the mathematic algorithm)
- he gets back 4096 real and 4096 imaginary frequency samples
- half of them are of no use because the second half of the samples are the conjugate values of the first half (first half real + imag second half real - imag ) the real values are the same the imaginary values are oppsite (sign changed)
My suggestions:
1)
- send, in the data() array to the FFT object, only the real values
- the imaginary 0 samples are generated inernally in the FFT dll
- get back only the first half of the real and imaginary samples, only the useful ones
2) or eventually use a 'FFT algorithm specialized for real and/or symmetric data' with the same inputs and outputs.
Fast Fourier transform - Wikipedia, the free encyclopedia
In redbirds example.
sending 4096 samples instead of 8192
getting back two sets of 2048 samples instead of two sets of 4096 samples
That's what I was used to, and that's what made my confusion at the beginning.
And I am shure that it will avoid confusions for others in the future.
I tested the library at the beginning with very low frequencies, this means that the succesive samples had relatively small differences. This was seen by the library as having the real and imaginary samples similar. So the results looked almosed coherent.
But with higher frequencies the results are wrong.
In frequency analisys the user is mostly interested in the highest peaks of the amplitude signal. Some analizers have a function returning a list of the frequencies higher than a certain threshold.
@agraham
Could you please take in consideration my suggestions, at least the 1st one.
For shure you can use my test program as the demo program !
I will make some improvements:
- add some more possibilities
- make a better more userfriendly interface
- add some help for the user
Best regards.