Skip to contents

The function, single_fft, runs the R implementation of the Fast Fourier Transform, fft, and returns a dataframe containing the single- sided FFT with columns for frequency and amplitude.

Usage

single_fft(data, window = TRUE, include_dc = TRUE, filter = 0.25,
sample_rate = 100)

Arguments

data

Dataframe containing columns for time and volts

window

Default true will window the data before transforming.

include_dc

Default true, will include DC component (amplitude at 0 Hz)

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 tibble object with two columns: Frequency and Amplitude. It is single-sided, and will select up to the Nyquist (sample_rate/2)

Details

If window = TRUE is chosen, then a Hann (Hanning) window is applied to the data for the transform. Additionally, window = TRUE will select a 2^10 = 1024 point data.frame from the center of the data in order to get a 'center cut' of the data and avoid irregularities around the edges.

See also

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