fftab {fftab} | R Documentation |
Perform FFT and IFFT with Tidy Results
Description
Provides functions to compute the Fast Fourier Transform (FFT) and its inverse (IFFT)
while maintaining results in a tabular format. Supports vectors, time series
(ts
), and arrays as inputs.
Usage
fftab(x, norm = FALSE)
## Default S3 method:
fftab(x, norm = FALSE)
## S3 method for class 'ts'
fftab(x, norm = FALSE)
## S3 method for class 'array'
fftab(x, norm = FALSE)
ifftab(x)
Arguments
x |
Input object for which to compute the FFT or IFFT. This can be:
|
norm |
Logical. If |
Details
-
fftab
organizes FFT results into a tibble for downstream analysis. -
ifftab
ensures that reconstructed signals match the input structure (e.g., arrays,ts
).
Value
-
fftab
: A tibble containing:Fourier frequencies (
.dim_1
,.dim_2
, etc.).FFT values stored in the
fx
column as complex values.
-
ifftab
: A vector, array, or time series object representing the reconstructed signal.
FFT
The fftab
function computes the FFT for different input types:
-
Default Input (
fftab.default
): Computes FFT for numeric vectors. -
Time Series Input (
fftab.ts
): Handles FFT forts
objects, scaling frequencies appropriately. -
Array Input (
fftab.array
): Processes multidimensional arrays.
Results are returned as a tibble containing Fourier frequencies and FFT values.
IFFT
The ifftab
function reconstructs the original signal from a fftab
object.
It supports vectors, arrays, and time series inputs. The inverse transform preserves
the original structure (e.g., array dimensions or time series attributes).
See Also
Examples
fftab(c(1, 0, -1, 0))
fftab(c(1, 0, -1, 0)) |> ifftab()
ts(sin(1:10), frequency = 12) |> fftab()
array(1:8, dim = c(2, 2, 2)) |> fftab()