ft_inv: Return an inverse FFT along with the time components

View source: R/ft_inv.R

ft_invR Documentation

Return an inverse FFT along with the time components

Description

The function returns a 2 column data frame with the first column named 't' containing the time components,
and the second column named 'Y' containing the complex valued signal components of the inverted FFT.

Usage

ft_inv(wf, fy)
ft_inv(wf, fy, w = F)
ft_inv(wf, fy, w = F, t_start = 10)

Arguments

wf

The discretized w-space vector of the fourier transsform is intended for invertion.
Note: in case the frequency space of the fourier transform is in w, then set "w = T"(set by default) and sampling time Ts = 2*pi/(N*ws).
In case the frequency space of the fourier transform is in f, then set "w = F" and sampling time Ts = 1/(N*ws).
N : no. of samples in your Fourier Transform.
ws : smallest frequency staep size of your fourier transfrom.
ws = 2*pi/T0, if "w = T".
ws = 1/T0, if "w = F".
T0 = N*Ts : T0 is the largest/global periodicity of the original signal that was fourier transformed from time domain.

fy

The complex fourier transformed samples intended for inverse fourier transformation.

w

A binary bit, when set to TRUE, Ts = 2*pi/(N*ws).
when set to FALSE, Ts = 1/(N*ws).
ws : Minimum frequency step in the wf vector.
Set to TRUE by default.

t_start

The first element of the vector t, t[1]
Note: incorrect assignment in t_start will lead to phase shifts in the inverted signal.
Set to zero by default.

Author(s)

Chitran Ghosal

Examples

library(StatsChitran) #call library
X <- seq(-10*pi, 10*pi, by=0.001) #build the X-vector
Y <- sin(3*X)                     #build the sinusoid Y-vector which oscillates 3 times within 2*pi
df <- ft(X, Y, w = T, set.nyquist = T) #build the fourier transform
df_back <- ft_inv(df$wf, df$fy, w = T, t_start=-10*pi) #calculate the inverse fourier transform
subplot(c(2,1)) #divide the graphics screen
plot(df$wf, abs(df$fy), type='b', col = 'red', xlim = c(-5,5), main = 'Fourier Transform') #plot the fourier transform
plot(df_back$t, df_back$Y, xlim=c(0, 2*pi), type='l', main ='Inverse Fourier Transform', col = 'red') #plot the inverse function
abline(v=c(0, 2*pi), h=0) #build global geometric markers
abline(v = c(1, 2)*2*pi/3, col='blue') #build local geometric markers
subplot(c(1,1)) #default to original graphics screen

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