Skip to contents

The function mainfreqs finds the main frequencies in voltage time- series data by using the Fast Fourier Transform.

Usage

mainfreqs(data, end = sample_rate/2, pre_fft = FALSE,
window = TRUE, filter = 0.25, sample_rate = 100)

Arguments

data

Either a voltage time series dataframe or a dataframe of Fourier transformed data with columns for frequency and amplitude. If the latter, change pre_fft to TRUE.

end

Numeric indicating number of frequencies to display, e.g. end = 10 will be top 10 frequencies. Default is all (half sample_rate)

pre_fft

TRUE/FALSE indicating whether or not the data being fed has been Fourier Transformed,

window

Default true will window the data before transforming.

filter

High pass filter indicating threshold frequency above which will be kept, and below which will be filtered out

sample_rate

The frequency of collection in Hz. Default is 100 Hz

Value

A dataframe containing the main frequencies with 2 columns is returned: frequency and amplitude.

Details

Main frequencies are determined as those having the largest amplitude. Frequencies are aggregated such that only the highest in each integer bin are kept and compared - e.g. if the data is 5.1 Hz, 5.2 Hz, only the largest will be kept for the 5.x Hz entry. Therefore if there are multiple main frequencies in the same bin, only the largest one will the kept and the others will be discarded.

See also

Other frequency related functions: plot_fbox(), plot_fft(), single_fft(), topfreq(), wave_topfreq()