Skip to contents

The function plot_fft allows one to visualize the results of a Fourier Transform and check for peaks - main constituent frequencies.

Usage

plot_fft(data, end = NULL, include_dc = FALSE, 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

Default is NULL to plot all data. Otherwise, insert numeric value corresponding to the maximum frequency you would like to plot. This does not affect the frequency values themselves, it merely selects the portion of the graph to view.

include_dc

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

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 plot showing amplitude vs frequency of the Fourier Transformed data.

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(), single_fft(), topfreq(), wave_topfreq()