user1798339
user1798339

Reputation: 57

inverse FFT - get the sign of the absolute value

i'm using org.apache.commons.math3.transform Class FastFourierTransformer, i'm now trying to apply FFT on real data set, and the apply inverse FFT to get the original data set. my problem is that in order to get the original data set i'm using the function abs() of complex number and i'm getting the correct number but not the correct sign. in the original data set i have minus but on the inverse data set i'm getting only positive numbers. do you have any idea what i should do to get the correct sign?

Upvotes: 0

Views: 931

Answers (1)

user2127434
user2127434

Reputation:

The correct way to get the sign of a number that is lost after taking the absolute value is not to take the absolute value. An inverse FFT should undo a previous FFT. Hence your complex result should, if your original data was real, already be real numbers (with the imaginary part zero, except for rounding errors). So you will want to only use the real part (rather than take the absolute value). Remember to include a sanity check: Make sure the imaginary parts are really negligibly small!

Upvotes: 1

Related Questions