FFTINIT Function
Computes the parameters for a one-dimensional FFT to be used in function FFTCOMP with keyword Init_Params.
Usage
result = FFTINIT(n)
Input Parameters
n—Length of the sequence to be transformed.
Returned Value
result—A one-dimensional array of length 2n + 15 that can then be used by FFTCOMP when the optional parameter Init_Params is specified.
Input Keywords
Double—If present and nonzero, double precision is used and the returned array is double precision. This keyword does not have an effect if the initialization is being computed for a complex FFT.
Complex—If present and nonzero, the parameters for a complex transform are computed.
Sine—If present and nonzero, then parameters for a discrete Fourier cosine transformation are returned. See keyword Sine in function FFTCOMP.
Cosine—If present and nonzero, then parameters for a discrete Fourier cosine transformation are returned. See keyword Sine in function FFTCOMP.
Discussion
Function FFTINIT should be used when many calls are to be made to function FFTCOMP without changing the data type of the array and the length of the sequence. The default action of FFTINIT is to compute the parameters necessary for a real FFT. If parameters for a complex FFT are needed, keyword Complex should be specified.
The FFTINIT function is based on the routines RFFTI and RFFTI in
FFTPACK, which was developed by Paul Swarztrauber at the National Center for Atmospheric Research.
Example
In this example, two distinct, real FFTs are computed by calling FFTINIT once, then calling function FFTCOMP twice.
; Define the length of the signals.
n = 7
; Initialize the parameters by calling FFTINIT.
init_params = FFTINIT(7)
; For each pass through loop, compute a real FFT of an array of
; length n and output both original signal and computed FFT.
FOR j=0L, 2 DO BEGIN
p = COS(j * FINDGEN(n) * 2 * !Pi/n) &$
q = FFTCOMP(p, Init_Params=init_params)&$
PM, 'p', 'q', $
Format = '(7x, a1, 10x, a1)' &$
FOR i=0L, n-1 DO PM, p(i), q(i), $
Format='(f10.5, f10.2)' &$
ENDFOR
This results in the following output:
p q
1.00000 7.00
1.00000 0.00
1.00000 0.00
1.00000 0.00
1.00000 0.00
1.00000 -0.00
1.00000 0.00
p q
1.00000 0.00
0.62349 3.50
-0.22252 0.00
-0.90097 -0.00
-0.90097 -0.00
-0.22252 0.00
0.62349 -0.00
p q
1.00000 -0.00
-0.22252 0.00
-0.90097 -0.00
0.62349 3.50
0.62349 -0.00
-0.90097 0.00
-0.22252 0.00