Computes amplitude(s) and frequencies(s) of a wave form, amongst other things, based on a sampling frequency

amp.freq(x = NULL, y, sf = 100)

Arguments

x

Numeric; x position (or sample number)

y

numeric; y position

sf

numeric; sample frequency (i.e., how often was x and y sampled) in Hz

Value

a list with of the following:

  • a: a numeric vector of amplitudes ('a').

  • pos: a numeric vector of the position of critical points.

  • f: a numeric vector of the peak-to-peak frequencies (if the first critical point is a peak) or trough-to-trough frequencies (if the first critical point is a trough).

  • snr:a numeric value of the signal to noise ratio.

Details

computes amplitudes as half the distance between each successive pair of critical points (i.e., points where the derivative is zero).

See also

features

Examples


#Compute waveform patterns
x <- seq(0,pi,0.1)
y <- sin(x^1.3*pi)
plot(x,y)


amp.freq(x=x,y=y)
#> $a
#> [1] 0.9936235 0.9906554 0.9931397
#> 
#> $pos
#> [1]  7 15 21 27
#> 
#> $f
#> [1] 69.44444
#> 
#> $snr
#> [1] 38.76
#>