Estimates the power spectrum of a movement signal (Welch periodogram) and summarises the tremor within a frequency band: the dominant frequency, its peak power, absolute and relative in-band power, the half-power bandwidth (peak sharpness) and the first-harmonic ratio.
Usage
tremorSpectrum(
signal,
sampling_rate,
band = c(3, 12),
detrend = TRUE,
seg_sec = NULL
)Arguments
- signal
Numeric vector: one axis, or the vector magnitude, of an accelerometer / gyroscope / displacement signal (gravity removed for raw accelerometry).
- sampling_rate
Sampling rate in Hz.
- band
Length-2 tremor band
c(low, high)in Hz (defaultc(3, 12)).- detrend
Remove the signal mean before spectral estimation (default
TRUE; each Welch segment is also demeaned).- seg_sec
Optional Welch segment length in seconds (default: about an eighth of the record, rounded to a power of two).
Value
A list: dominant_freq_hz, peak_power, band_power_abs,
band_power_rel (in-band / total power), half_power_bw_hz,
harmonic_ratio (power at 2*f0 / power at f0), and the freq / psd
vectors.