[R] Is R's fast fourier transform function different from "fft2" in Matlab?

Rolf Turner r.turner at auckland.ac.nz
Fri Aug 1 05:30:27 CEST 2008


On 1/08/2008, at 2:56 PM, stephen sefick wrote:

>  z <- rnorm(5000)
>  f <- fft(z)
>  d <- fft(f, inverse=T)
> plot(z, d)
>
> z <- rnorm(5000)
> z.ts <- ts(z)
> f <- fft(z.ts)
> d <- fft(f, inverse=T)
> plot(z.ts, d)
>
> temp  <- matrix(c(1,4,2, 20), nrow=2)
> d <- fft(temp)
> f <- fft(d, inverse=T)
> plot(temp, f)
>
> this, looks to me, to be the same.

	Then I think you'd better get your eyes checked, mate!

> you have to take the inverse of the fft to get the original series.

	No you ***don't*** get the original series; you get n*(the original  
series)
	where n is the series length.

	I.e. the fft in R (and in S/Splus) does not apply any normalizing  
factor,
	so that the inverse transform only ``inverts'' up to a constant  
multiple.

		cheers,

			Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list