Skip to contents

These functions convert a fftab object to a specified representation:

  • to_cplx(): Converts to complex representation (fx).

  • to_rect(): Converts to rectangular representation (re, im).

  • to_polr(): Converts to polar representation (mod, arg).

Usage

to_cplx(x, .keep = "unused")

to_rect(x, .keep = "unused")

to_polr(x, .keep = "unused")

Arguments

x

A fftab object.

.keep

Specifies which columns to retain. See dplyr::mutate().

Value

A modified fftab object containing the specified representation:

  • to_cplx(): Adds the fx column for complex values.

  • to_rect(): Adds the re and im columns for rectangular components.

  • to_polr(): Adds the mod and arg columns for polar components.

Details

  • to_cplx(): Converts from rectangular (re, im) or polar (mod, arg) components to complex form.

  • to_rect(): Converts from complex (fx) or polar components to rectangular form.

  • to_polr(): Converts from complex (fx) or rectangular components to polar form.

Examples

fftab(c(1, 0, -1, 0)) |> to_cplx()
#> # A tibble: 4 × 2
#>   .dim_1 fx   
#> *  <dbl> <cpl>
#> 1   0    0+0i 
#> 2   0.25 2+0i 
#> 3   0.5  0+0i 
#> 4  -0.25 2+0i 

fftab(c(1, 0, -1, 0)) |> to_rect()
#> # A tibble: 4 × 3
#>   .dim_1    re    im
#>    <dbl> <dbl> <dbl>
#> 1   0        0     0
#> 2   0.25     2     0
#> 3   0.5      0     0
#> 4  -0.25     2     0

fftab(c(1, 0, -1, 0)) |> to_polr()
#> # A tibble: 4 × 3
#>   .dim_1   mod   arg
#>    <dbl> <dbl> <dbl>
#> 1   0        0     0
#> 2   0.25     2     0
#> 3   0.5      0     0
#> 4  -0.25     2     0