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

Alvaro Aballe Villero (alvaro.aballe@uca.es)
Wed, 01 Jul 1998 14:08:48 +0200

First, I want to thank who have answered to me.

But, I would like to do a comment about Doug Johnson's answer. I thought
the "compare.tapered.fft.power.with.spec.pgram.power.demo.fn" function
provides very different values for the first points because the
"spec.pgram" function estimates the spectrum after "detrend" the input by
the fault. But if I change the function (demean=F):
compare.fft <-
function()
{
plot(x = 10 * log10(sqrt(Re(fft(
spec.taper(lynx, p = 0.1
))[1:58])^2 + Im(fft(
spec.taper(lynx, p = 0.1
))[1:58])^2)), y = (
spec.pgram(lynx, demean=F)\$spec[1:
58]), type = "n")
text(x = 10 * log10(sqrt(Re(fft(
spec.taper(lynx, p = 0.1
))[1:58])^2 + Im(fft(
spec.taper(lynx, p = 0.1
))[1:58])^2)), y = (
spec.pgram(lynx,demean=F)\$spec[1:
58]), labels =
as.character(1:58))
title(main = "lynx (n = 114)")
title(main = "\n(power spectrum using 'spec.pgram(,demean=F)' vs power
spectrum using 'spec.taper()' and 'fft()', in decibels)",
cex = 0.6, font = 2)
}
the difference carries on. Do you know why these functions work in
difference way?

Also, now I have a doubt: If a vector is in X unit, which unit will I get,
X or X^2, when I use the function "spec.pgram"? I thought I get X^2, this
is the reason why I am puzzle that you use "sqrt" in "sqrt
(Img(fft())^2+Re(fft())^2)" to try to get the same result than using
"spec.pgram".

And another specific question is: The "fft" function returns the
(non-normalized) fast Fourier Transform, but which do I get with
"spec.pgram"; non.normalized or normalized? That is; Must I divide the
output of the function "spec.pgram" by any number to get the usual result?

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.:956830828
Fax:956834924

=======================================================
-----------------------------------------------------------------------
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