Skip to contents

These utility functions extract specific components from a fftab object. get_fx retrieves the raw Fourier coefficients, while get_fx_norm ensures the coefficients are either normalized or not normalized based on the norm parameter.

Usage

get_fx(x)

get_fx_norm(x, norm = FALSE)

get_re(x)

get_im(x)

get_mod(x)

get_arg(x)

Arguments

x

A fftab object containing FFT results.

norm

Logical. If TRUE, forces normalized coefficients. If FALSE, ensures non-normalized coefficients.

Value

The requested components:

  • get_fx: A complex vector of raw Fourier coefficients (fx) as stored in the object.

  • get_fx_norm: A complex vector of Fourier coefficients, explicitly normalized or non-normalized based on the norm parameter.

  • get_re: A numeric vector of real parts (re).

  • get_im: A numeric vector of imaginary parts (im).

  • get_mod: A numeric vector of magnitudes (mod).

  • get_arg: A numeric vector of phase angles (arg), in radians.

Details

  • get_fx: Returns coefficients as they are stored in the fftab object.

  • get_fx_norm: Adjusts coefficients if they are not in the desired normalization state.

  • get_re, get_im: Extract real and imaginary components.

  • get_mod, get_arg: Compute magnitude and phase of coefficients.

Examples

fftab(c(1, 0, -1, 0)) |> get_fx()
#> [1] 0+0i 2+0i 0+0i 2+0i

fftab(c(1, 0, -1, 0)) |> get_fx_norm(norm = TRUE)
#> [1] 0.0+0i 0.5+0i 0.0+0i 0.5+0i

fftab(c(1, 0, -1, 0)) |> get_re()
#> [1] 0 2 0 2

fftab(c(1, 0, -1, 0)) |> get_im()
#> [1] 0 0 0 0

fftab(c(1, 0, -1, 0)) |> get_mod()
#> [1] 0 2 0 2

fftab(c(1, 0, -1, 0)) |> get_arg()
#> [1] 0 0 0 0