Snake
Snake

Reputation: 14648

FFT confusion using JTransform

I have been reading all the posts in SO about FTT and using JTransform. I have a Real Data and it has the size of N. I would like to pass it to FFT so that I can calculate the magnitude at every frequency.

I have it done in matlab using the FFT function and I am trying to do the same in Java. My question is:

Do use RealForward or RealForwardFull? Or possibly creating another array with 0 imag and pass it to complex forward? How big is the resulting FTT?

Upvotes: 1

Views: 941

Answers (1)

KillaKem
KillaKem

Reputation: 1025

When you compute the DFT of an N - element array of real numbers, your result will be an N - element array of complex numbers.Now looking at the JTransform Documentation, in Jtransforms these complex numbers are represented as a pair of 2 real numbers (one representing the Real part and the other the imaginary) so your FFT result will actually be twice as long as your FFT input.

RealForwardFull computes the FFT of an array and returns all FFT coefficients whilst RealForward will only return half of the coefficients.The reason RealForward might suite some peoples needs is because the FFT has a symmetrical property, so by knowing just half of the coefficients you can obtain the rest of the coefficients using symmetrical properties of the FFT.

Upvotes: 3

Related Questions