Skip to contents

These functions convert dimensions of frequency from cyclic (measured in cycles) to angular (measured in radians) or vice versa. This transformation scales dimensions by a factor of 2 * pi.

  • to_angf(): Converts from cyclic to angular frequency.

  • to_cycf(): Converts from angular to cyclic frequency.

Usage

to_angf(x)

to_cycf(x)

Arguments

x

An fftab object containing frequency dimensions. Must include columns prefixed with .dim_ and have an attribute .is_angular indicating the frequency type.

Value

An fftab object with dimensions scaled appropriately and the .is_angular attribute updated.

Examples

# Convert cyclic to angular frequencies
rnorm(64) |>
  fftab() |>
  to_angf() |>
  to_rect() |>
  dplyr::slice_max(abs(.dim_1), n = 5)
#> # A tibble: 5 × 3
#>   .dim_1    re    im
#>    <dbl> <dbl> <dbl>
#> 1   3.14  1.11  0   
#> 2   3.04  3.74 -4.57
#> 3  -3.04  3.74  4.57
#> 4   2.95 -1.11  2.52
#> 5  -2.95 -1.11 -2.52

# Convert angular back to cyclic frequencies
rnorm(64) |>
  fftab() |>
  to_angf() |>
  to_cycf() |>
  to_rect() |>
  dplyr::slice_max(abs(.dim_1), n = 5)
#> # A tibble: 5 × 3
#>   .dim_1     re    im
#>    <dbl>  <dbl> <dbl>
#> 1  0.5   -14.5   0   
#> 2  0.484   5.90  3.02
#> 3 -0.484   5.90 -3.02
#> 4  0.469   7.01  6.27
#> 5 -0.469   7.01 -6.27