Skip to contents

Calculate the peak frequency per axis for acceleration bursts

Usage

peak_frequency(x, resolution = NA)

Arguments

x

An acc vector

resolution

A scalar with the units Hertz

Value

returns a list with the same length as x with the peak frequency per axis

Details

To increase the resolution of the result zero padding can be used. This can be controlled using the resolution argument. Note that increasing resolution without increasing the number of samples in a acceleration burst has a limited ability to get closer to the true frequency.

Examples

  a<-acc(list(cbind(z=cos(1:200/(80/(pi*2))),
  x=sin(1:200/(5/(pi*2))))), units::set_units(400,'Hz'))
  peak_frequency(a)
#> [[1]]
#> Units: [Hz]
#>  z  x 
#>  6 80 
#> 
  peak_frequency(a, units::set_units(.25, "Hz"))
#> [[1]]
#> Units: [Hz]
#>  z  x 
#>  5 80 
#> 
  # Increasing resolution more
  peak_frequency(a, units::set_units(.005, "Hz"))
#> [[1]]
#> Units: [Hz]
#>      z      x 
#>  5.115 79.995 
#> 
  a<-acc(list(cbind(z=cos(80+1:200/(80/(pi*2))),
  x=sin((1:200)/(5/(pi*2))))), units::set_units(400,'Hz'))
  peak_frequency(a, units::set_units(.005, "Hz"))
#> [[1]]
#> Units: [Hz]
#>      z      x 
#>  4.875 79.995 
#>