[R] fft help

FMGCFMGC FMGCFMGC at terra.es
Tue Mar 11 20:19:41 CET 2003


Hello!

I suppose you want to obtain a fft of length, for example, 1024, from a 
vector of size 100.

Fill the original vector with zeros to reach the desired length. This 
is called 'zero padding'

fftn <- function(x, n) {
  # fftn() - FFT of length n of a vector x
  # Note: It does not check if n<length(x)
  nx <- length(x)
  xx <- c(x, rep(0, n-nx))
  fft(xx)
}

See also ?nextn

Hope it helps!
Fran



More information about the R-help mailing list