# [S] "fft" vs. "spec.pgram" (unnormalize?)

Alvaro Aballe Villero (alvaro.aballe@uca.es)
Tue, 30 Jun 1998 11:19:53 +0200

Dear S-plus users:

I have a problem with the fast Fourier transform, which perhaps you can
solve easily. I read in the help file that fft function do the "unormalize
discrete Fourier transform", but I can understand what "unormalize"
means"". That is:

Let's call "data" a vector with 2048 points,
Data<-sin(1:2048/50)
I want to compare the spectra using "fft" and using "spec.pgram". So, if
"borr.1" is the Fourier transform:
borr.1<-(fft(Data))
the spectrum will be:
borr.2<- (borr.1[1:1025]*Conj(borr.1[2:1025]))/2048
The denominator "2048" is used to normalize the spectrum; and I take only
the first 1025 elements because the remanding ones are the same to the
first in opposite order.
Now, the spectrum object using the function "spec.gram" will be called
"borr.3":
and the vector in normal scale (no dB) is "borr.4":
borr.4<-10^(borr.3\$spec/10)
THESE BOTH VECTORS "borr.2" and "borr.4 " ARE THE SAME.

HOWEVER: when I want to retrieve the original "Data" I have to proceed in
this way:
borr.5<-fft(borr.1/2048,inverse=T)
Now "borr.5" is equal to Data.

SO, What is the normalize FFT? Can you clarify my mind?

Thanks.

=======================================================

Álvaro Aballe Villero
Dpto. Ciencias de los Materiales e Ingeniería
Metalúrgica y Química Inorgánica. Facultad de Ciencias.
Apartado 40 - 11510, Puerto Real (Cádiz) SPAIN.
Tel.:9-56830828
Fax:9-56834924

=======================================================
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news