[R] Weird (wrong?) result for fft

Filippo Monari |ng||mo @end|ng |rom gm@||@com
Mon Mar 22 17:17:11 CET 2021


Hi all,

I am plying around with fft function from the stats package.
Running the example that is listed in the documentation:

x <- 1:4
fft(x) #output 1
fft(fft(x), inverse = TRUE)/length(x) #output 2

I was expecting that output 1 and two were the same but I get:

> fft(x)
[1] 10+0i -2+2i -2+0i -2-2i

> ft(fft(x), inverse = TRUE)/length(x)
[1] 1+0i 2+0i 3+0i 4+0i

Am I doing something wrong or is there a bug somewhere?

Regards,
Filippo

	[[alternative HTML version deleted]]



More information about the R-help mailing list