Fast Fourier Transform Real
Fast Fourier Transform Real
Fast Fourier Transform Real
What about the reverse process? Suppose you have two complex transform
arrays, each of which has the symmetry (12.3.1), so that you know that the inverses
of both transforms are real functions. Can you invert both in a single FFT? This is
even easier than the other direction. Use the fact that the FFT is linear and form
the sum of the first transform plus i times the second. Invert using four1 with
isign = −1. The real and imaginary parts of the resulting complex array are the
two desired real functions.
The discussion of program twofft tells you how to separate the two transforms
Fne and Fno out of Hn . How do you work them into the transform Fn of the original
data set fj ? Simply glance back at equation (12.2.3):
A few remarks:
• Since FN−n * = Fn there is no point in saving the entire spectrum. The
positive frequency half is sufficient and can be stored in the same array as
the original data. The operation can, in fact, be done in place.
• Even so, we need values Hn , n = 0, . . . , N/2 whereas four1 gives only
the values n = 0, . . . , N/2 − 1. Symmetry to the rescue, HN/2 = H0 .
12.3 FFT of Real Functions, Sine and Cosine Transforms 513
• The values F0 and FN/2 are real and independent. In order to actually
get the entire Fn in the original array space, it is convenient to put FN/2
into the imaginary part of F0 .
• Despite its complicated form, the process above is invertible. First peel
FN/2 out of F0 . Then construct
1
Fne = *
(Fn + FN/2−n )
2 n = 0, . . . , N/2 − 1 (12.3.6)
1
Fno = e−2πin/N (Fn − FN/2−n
*
)
2
(1) (2)
and use four1 to find the inverse transform of Hn = Fn + iFn .
Surprisingly, the actual algebraic steps are virtually identical to those of
the forward transform.
Here is a representation of what we have said:
#include <math.h>
N−1
Fk = fj sin(πjk/N ) sine transform (12.3.7)
j=1
2N−1
N
2πijk/(2N)
fj e = f2N−j e2πi(2N−j )k/(2N)
j=N j =1
(12.3.10)
N−1
=− fj e−2πij k/(2N)
j =0