From: Rolf Turner <r.turner_at_auckland.ac.nz>

Date: Thu, 31 Jul 2008 09:15:19 +1200

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 Jul 2008 - 21:20:54 GMT

Date: Thu, 31 Jul 2008 09:15:19 +1200

On 30/07/2008, at 11:14 PM, <renata.camargo05_at_ntlworld.com> wrote:

> Hello,

*>
**> I have calculated the fourier transform of the series enclosed at
**> the end of this message, by doing:
**>
**> library(stats)
**> x <- readLines("file1.txt")
**> x.num <- as.numeric(x)
**> ft.x.num <- fft(x.num)
**>
**> My question is: why is the first value (Real) of ft.x.num that big?
**> (954.833870) all the other values are much smaller. Am I doing
**> something wrong?
**>
**> Could you please help me to understand that?
*

Just look at the definition of the discrete Fourier transform:

n X(omega) = SUM x_t * exp(i*omega*t) t=1

(The mailer will probably mess up that expression and put everything
out of alignment;

if only these <expletive deleted> mailers would leave well enough
alone and simply

transmit plain ascii files and display the results in a fixed width
font .....

Anyway, I hope you can read it.)

The point is that the fast Fourier transform calculates the discrete
Fourier transform

at each of the ``Fourier'' frequencies omega_j = 2*pi*j/n, j =
0, ..., n-1. The result is,

as you noted in your follow-up email ``palindromic'' --- X(omega_{n-
j}) = X(omega_j)^*

where ``*'' indicates complex conjugate.

At omega_0 = 0 you obviously get X(omega_0) = sum(x) --- that's where
the value 954.833870

comes from. Just execute sum(x) to check this.

If you want to understand the discrete Fourier transform, I suggest
you read Peter Bloomfield's

book ``Fourier Analysis of Time Series --- An Introduction'' (2nd
ed.), Wiley Series in

Probability and Statistics, 2000.

cheers,

Rolf Turner

P.S. BTW doing ``library(stats)'' is silly; the stats library is
loaded automatically

when R is started.

R. T.

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

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 Jul 2008 - 21:20:54 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Wed 30 Jul 2008 - 22:33:08 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*