Learn R Programming

fftab (version 0.1.0)

fourier_frequencies: Compute Fourier Frequencies

Description

Computes Fourier frequencies for various types of inputs, such as scalars, vectors, matrices, time series, or arrays. This generic function dispatches appropriate methods based on the input type.

Usage

fourier_frequencies(x)

# S3 method for default fourier_frequencies(x)

# S3 method for ts fourier_frequencies(x)

# S3 method for array fourier_frequencies(x)

Value

A tibble where:

  • .dim_1, .dim_2, ..., represent the Fourier frequencies for each dimension.

Arguments

x

The input object. Supported input types:

  • Scalar or vector: The length of the sequence.

  • Time series (ts): Frequencies are scaled based on the sampling rate.

  • Multidimensional array or matrix: Frequencies are computed for each dimension.

Details

This function has the following methods:

  • Default Input (fourier_frequencies.default): Computes normalized Fourier frequencies for scalar or vector inputs.

  • Time Series Input (fourier_frequencies.ts): Computes frequencies scaled by the frequency attribute of a ts object.

  • Multidimensional Arrays (fourier_frequencies.array): Computes frequencies for each dimension of a matrix or array.

See the examples for details on each case.

See Also

Examples

Run this code
# Default input (vector)
fourier_frequencies(8)

# Time series input
ts(rnorm(36), frequency = 12) |> fourier_frequencies()

# Multidimensional array input
array(1:27, dim = c(3, 3, 3)) |> fourier_frequencies()

# Matrix input
matrix(1:9, nrow = 3, ncol = 3) |> fourier_frequencies()

Run the code above in your browser using DataLab