ft: Return an FFT along with the freq components

View source: R/ft.R

ftR Documentation

Return an FFT along with the freq components

Description

The function returns a 2 column data frame with the first column (named fr or wf, depending whether w=F or w=T in the arguments respectively) containing the frequencies of the frequency space. The second column named fy contains the complex values of the fourier transform

Usage

ft(X,Y,w=F, set.nyquist = T)

Arguments

X

Contains the X component of the input function

Y

Contains the Y component of the input function

w

Set to w=F by default, it toggles between fr or wf=2*pi*fr on the frequency axis

set.nyquist

Ordinarily set to true, this argument(when true) promotes the dataset which is greater than half of the sampling frequency to the negative frequencies.
This is mathematically allowed since the DFT is periodic in frequency domain.
Basically converts a one sided DFT to a two sided fourier transform.

Author(s)

Chitran Ghosal

Examples

library(StatsChitran) #Call library
X <- seq(-10*pi, 10*pi, length=200) #define the X values
Y <- sin(3*X) #define the Y values
df <- ft(X, Y, w = T, set.nyquist = T) #call the two-sided fourier transform
plot(df$wf, abs(df$fy), type='b', c(-5,5)) #plots the amplitude function
abline(v = c(-3, 3), col='red') #draws vertcals along the expected frequency points
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x)
{
  }

Chitran1987/StatsChitran documentation built on Feb. 23, 2025, 8:30 p.m.