SignalProcessing
FFT
compute forward fast Fourier transform
InverseFFT
compute inverse fast Fourier transform
Calling Sequence
Parameters
Options
Description
Thread Safety
Examples
Compatibility
FFT(A)
FFT(A1, A2)
InverseFFT(A)
InverseFFT(A1, A2)
A
-
Array or list of complex numeric values; the signal
A1, A2
Arrays or lists of real numeric values corresponding to the real and imaginary parts of the signal
container : Array or [Array, Array], predefined Array(s) for holding results
inplace : truefalse, specifies that output should overwrite input
normalization : name, type of normalization
dimension : integer or [integer] or all or "all"
size : posint, keyword same or recommended, or list of any of these, specifies the final size of the signal containers
The FFT(A) command computes the fast Fourier transform (FFT) of the Array A and returns the result in an Array with datatype complex[8]. With two Array arguments, invoked as FFT(A1, A2), the command interprets A1 and A2 as giving the real and imaginary parts of the input signal, respectively, and returns the result as a sequence of two Arrays with datatype float[8]. These Arrays are the real and imaginary parts of the output signal. For this calling sequence, A1 and A2 must have the same number of elements.
The InverseFFT(A) command computes the inverse fast Fourier transform of the Array A and returns the result in an Array with datatype complex[8]. With two Array arguments, invoked as InverseFFT(A1, A2), the command interprets A1 and A2 as giving the real and imaginary parts of the input signal, respectively, and returns the result as a sequence of two Arrays with datatype float[8]. These Arrays are the real and imaginary parts of the output signal. For this calling sequence, A1 and A2 must have the same number of elements.
Before the code performing the computation runs, the input Array(s) are converted to datatype complex[8] (for the calling sequences with A) or float[8] (for the calling sequences with A1 and A2) if they do not have that datatype already. For this reason, it is most efficient if the input Array(s) have this datatype beforehand.
It is recommended that the number of elements of A be a power of 2 greater than 2. If you use FFT on a sample not satisfying this requirement, it will use SignalProcessing:-DFT instead; similarly, if you use InverseFFT on such a sample, it will use SignalProcessing:-InverseDFT.
The code underlying these commands (in the Intel Integrated Performance Primitives (IPP) library, see software.intel.com/en-us/intel-ipp) does not support Arrays of dimension two or higher directly. However, when called with such an Array, these commands call the FourierTransform or InverseFourierTransform commands in the DiscreteTransforms package instead, which supports Arrays with dimension at most 5. In this case, the container option cannot be used.
For more information on Fourier transforms in Maple, including a summarized comparision of SignalProcessing[FFT], SignalProcessing[DFT], and DiscreteTransforms[FourierTransform], see Fourier Transforms in Maple.
The option normalization must be one of the following: none, symmetric or full. If normalization is none, then the FFT is computed without any normalization. If it is symmetric, then the transforms are computed using 1N as the multiplier for both the forward and inverse transforms. If it is full, then 1N is used as the multiplier, where N is the length of A.
If the container=C option is provided, and there is a single rtable argument A, then the results are put into C and C is returned. In this case, the container C must be an Array having datatype complex[8] and size equal to that of A.
If the container = [C1, C2] option is provided, and there are two rtable arguments A1 and A2, then the results are put into C1 and C2 and they are returned. In this case, C1 and C2 must be Arrays having datatype float[8] and size equal to that of A1.
With this option, no additional memory is allocated to store the result.
If the inplace or inplace=true option is provided, then A or A1 and A2 are overwritten with the results. In this case, the container option is ignored. Furthermore, if A is specified, it must have datatype complex[8], and if A1 and A2 are specified, they must have datatype float[8].
The option dimension specifies the array dimension to be transformed. If dimension = all or dimension = "all" is provided, then the array is transformed in all dimensions. The default is all.
The option size is used to tell Maple to use either padded or truncated versions of the data container(s). Padding is helpful due to the increase in both the speed of computation and the frequency resolution.
Suppose the input is one-dimensional of size N. If size = same, which is the default, then the size of the input will remain the same. If size = recommended and N is not a power of 2, then the size of the input will be increased to the smallest power of 2 larger than N. (If size = recommended and N is already a power of 2, then the size will not change.) If size is a positive integer M, then the size of the input will either be truncated or padded with zeros so that the final size is M.
Suppose the input is multi-dimensional. If size is a list, then each element is applied to the corresponding dimension as specified in the dimension option. If size is not a list, then the value applies to each dimension as specified in the dimension option. Note that any given dimension can only be resized at most once.
If inplace = true, then the input will be padded or truncated in-place. Note that a multi-dimensional input cannot be truncated in-place.
If the container option is provided, any storage rtable must have the same size as the padded/truncated version of the input.
The subtype and starting indices of the output of the FFT and InverseFFT commands are the same as the input. For example, if A is a row Vector, then FFT(A) is a row Vector, and if B is an Array with starting indices 0, then FFT(B) is an Array with starting indices 0.
The SignalProcessing:-FFT and SignalProcessing:-InverseFFT commands are thread-safe as of Maple 17.
For more information on thread safety, see index/threadsafe.
with⁡SignalProcessing:
Example
a≔GenerateTone⁡8,1,1π,π:
b≔FFT⁡a
b≔
c≔InverseFFT⁡b
c≔
Norm⁡map⁡fnormal,a−c
0.
b≔FFT⁡a,normalization=full
c≔InverseFFT⁡b,normalization=full
0.875000000000000000
A := Array( 1 .. 1024, proc( n ) local s := 0; local m := n; while m <> 0 do s := s + irem( m, 10, 'm' )^2 end end, 'datatype' = 'float'[ 8 ] ):
U≔FFT⁡A:
useplotsindisplay⁡listplot⁡A,listplot⁡map⁡ℜ,U1..512,listplot⁡map⁡ℑ,U1..512end use
We can also use the other calling sequence, to get the real and imaginary parts split. In this case, we have to explicitly specify the imaginary part of the input as 0.
zeros≔Array⁡1..1024,datatype=float8:
U1,U2≔FFT⁡A,zeros:
useplotsindisplay⁡listplot⁡A,listplot⁡U11..512,listplot⁡U21..512end use
with⁡ImageTools:
img≔Read⁡cat⁡kernelopts⁡datadir,/images/phone.jpg
Embed⁡Create⁡img
m≔FFT⁡img:
InverseFFT⁡m
m2≔PowerSpectrum⁡m:
Embed⁡Create⁡m2
m3≔FFTShift⁡m2:
Embed⁡Create⁡m3
A≔Vector⁡1,2−I,3,datatype=complex8
A≔
FFT⁡A,size=same
FFT⁡A,size=recommended
FFT⁡A,size=5
X≔Array⁡0.904722238067363,0.721227498581740,0.488897743920167,0.507858284661118,0.904880968679893,0.587044704531417,0.446783749429806,0.744074260367462,0.335356839962797,0.546805718738968,0.296675873218327,0.923379642103244,0.875942811492984,0.775712678608402,0.698745832334794,0.796183873585212,0.237283579771521,0.711215780433683,0.227664297816554,0.532825588799455,0.780227435151377,0.903720560556316,0.0377388662395521,0.730330862855453,0.594896074008614,0.194764289567049,0.644318130193692,0.183511155737270,0.494173936639270,0.395515215668593,0.801014622769739,0.111119223440599,0.470923348517591,0.510771564172110,0.744692807074156,0.479922141146060,0.136553137355370,0.231594386708524,0.424166759713807,0.184816320124136,0.622475086001227,0.435858588580919,0.0305409463046367,0.261871183870716,0.963088539286913,0.117417650855806,0.311102286650413,0.939001561999887,0.929385970968730,0.334163052737496,0.913286827639239,0.578525061023439,0.602843089382083,0.170708047147859,0.811580458282477,0.625618560729690,0.715037078400694,0.987982003161633,0.928854139478045,0.408719846112552,0.844308792695389,0.794831416883453,0.686775433365315,0.653757348668560,0.679135540865748,0.262482234698333,0.438869973126103,0.301246330279491,0.508508655381127,0.296320805607773,0.500022435590201,0.679727951377338,0.521135830804001,0.318778301925882,0.430207391329584,0.550156342898422,0.486791632403172,0.197809826685929,0.0987122786555743,0.458848828179931,0.221746734017240,0.435698684103899,0.350727103576883,0.0811257688657853,0.890922504330789,0.885168008202475,0.488608973803579,0.262211747780845,0.225921780972399,0.378609382660268,0.368484596490336,0.779051723231275,0.367436648544477,0.0292202775621463,0.258064695912067,0.230488160211558,0.817627708322262,0.188955015032545,0.106761861607241,0.624060088173690,0.0855157970900440,0.979748378356085,0.207742292733028,0.306349472016557,0.547008892286345
Y1≔FFT⁡X,dimension=1,−1
Y2≔FFT⁡X,size=recommended,dimension=1,−1
Y3≔FFT⁡X,size=4,8,dimension=1,−1
The SignalProcessing:-FFT and SignalProcessing:-InverseFFT commands were introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
The SignalProcessing:-FFT and SignalProcessing:-InverseFFT commands were updated in Maple 2023.
The size option was introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
Applications
Identifying Periodicity of Sunspots
Pricing European Call Options with FFTs
See Also
DiscreteTransforms[FourierTransform]
fourier_in_maple
SignalProcessing[DCT]
SignalProcessing[DFT]
SignalProcessing[DWT]
SignalProcessing[FFTShift]
Download Help Document