Re:[ncl-talk] 1D fft and spectra

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun, 27 May 2007 22:40:25 -0600 (MDT)

I responded to Verica. Perhaps I did not post to ncl-talk.

I have attached a script. It clearly demonstrates that

[1] The shape of the periodograms calculated via ezfftf and
    specx_anal are the same. If you want the ezfftf periodogram
    estimates to have the same scale, multiply the
    values by (N/2).
           ;spcfft = spcfft*(nw/2) ; normalize

[2] The scales are different. As noted in the documentation,
    the specx_anal periodogram has been normalized so that
    the area under the curve is the same as the population
    variance of the input data.

[3] The attached script explicitly calculates the area.
    The variance matches the input series.

Cheers!

On Mon, 28 May 2007, xiexin163_at_zju.edu.cn wrote:

>
> Hi,
>
> I have the same problem as Verica has when I use these two functions
> to calculate some power spectra(raw periodogram). However, I also got
> different anwsers. Following the description on the specx_anal site, I know
> that what specx_anal is trying to do is first calculate the fourier
> coefficients of sine and cosine. Then it calculate each (ak^2+bk^2)/2.
> That is periodogram.
>
> To prove that, I use ezfftf to do the same thing as the above but got
> anwsers different from what specx_anal gives. The result from specx_anal
> is quite larger than what ezfftf gives. Thought not totally the same, the
> plot shape is quite similar. I do not know whether the definitions of
> these two are the same. Anyone can explain that?
>
> Your help is appreciated!
>
> Xie Xin
>
> > Hi All,
> >
> > I have a question regarding the 1D fft and 1D spectra, in respect to
> > the very different results for the spectra constructed using ezfftf
> > comparing to the spectra from specx_anal.
> > Attached is the plot with the resulting curves. On the left hand side
> > is specx_anal curve, and on the right hand side is the curve from
> > ezfftf.
> > In addition to very different shape of the curve and very different
> > values on the Y axis, I have also found a mismatch between the
> > variances calculated from the two spectra. From the description of
> > the specx_anal, area under the curve should give the total variance
> > of the initial v
> > ariable. I've tried comparing the variance with the area under the
> > curve from ezfftf and curve from specx_anal and I get about 5 times
> > larger value for the integral under specx_anal:
> > integral(spectra from ezfftf) = 0.291434
> > variance(data) = 0.292072
> > xvari = 0.291501
> > xvaro = 0.291501
> > integral(spectra from specx_anal) = 1.71725
> > xvari and xvaro are the attributes of the result of specx_anal.
> >
> > In addition to the plot, I've also attached the code with both
> > routines and a file with sample of data I used for this example.
> >
> > Does someone know what is the difference?
> >
> > Thank you,
> > Verica
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Sun May 27 2007 - 22:40:25 MDT

This archive was generated by hypermail 2.2.0 : Tue May 29 2007 - 07:20:14 MDT