calc_fft: Fast Fourier Transform (FFT) of a function

View source: R/dsp_tools.r

calc_fftR Documentation

Fast Fourier Transform (FFT) of a function

Description

Provides a utility wrapper for the builtin FFT function that is applied directly to function objects and that allows for the specification of desired sampling intervals, number of sampling points and spatial and amplitude scaling.

Usage

calc_fft(func, NFFT, range, scale_spatial = 1, scale_amp = 1)

Arguments

func

The function to be fft-ed.

NFFT

The number of sample points to be taken, thus the number of points in the fft.

range

The (spatial/temporal) range from which the samples are to be selected. Expected to be a two-element numerical vector. First element should be the smaller of the two boundaries. Note that the lower boundary will not be sampled since lower_bound + stepsize is taken as the starting point.

scale_spatial

(Optional) Can be given to take the fft of func(scale_spatial * x) instead of func(x). Yields exactly the same result as 'calc_fft(function(x) func(2*x), NFFT, range)'.

scale_amp

(Optional) Scale the amplitude of func by taking the fft of scale_amp * func(x) instead of func(x).

Value

An object of class "fft" that has two properties: $fft, which contains the actual result of the fft, and $vars, which contains a variety of parameters involved with the fft, such as the sampled frequencies, etc.


ime-luebeck/semgsim documentation built on April 14, 2022, 11:02 p.m.