View source: R/signal_helpers.R
sig_ifft | R Documentation |
This function computes the inverse of the one-dimensional n-point discrete Fourier
transform computed by fft using a wrapper of fft(z, inverse= TRUE)/length(z)
with
an extra argument making it similar to numpy.fft.ifft.
For a general description of the algorithm and definitions, see stats::fft and numpy.fft.
sig_ifft(x, n = NULL)
x |
A vector |
n |
Length of the transformed axis of the output. If |
The input should be ordered in the same way as is returned by fft, i.e., (if I converted the indexes from python correctly)
a[1]
should contain the zero frequency term,
a[2:ceiling(n/2)]
should contain the positive-frequency terms,
a[ceiling(n/2) + 2:length(a)]
should contain the negative-frequency terms,
in increasing order starting from the most negative frequency.
For an even number of input points, a[ceiling(n/2)]
represents
the sum of the values at the positive and negative Nyquist frequencies,
as the two are aliased together. See see numpy.fft for details.
Notes
If the input parameter n
is larger than the size of the input,
the input is padded by appending zeros at the end. Even though this is
the common approach, it might lead to surprising results. If a different padding
is desired, it must be performed before calling ifft.
A vector
a <- c(0, 4, 0, 0)
sig_ifft(a)
sig_ifft(sig_fft(a)) == a
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.