Hi,
It appears that there is an ambiguity with the normalization in 'cfftf':
To obtain a normalized transform the output must be divided by "N",
the size of the rightmost dimension.
This works fine to obtain the 'average'; but when computing the power
spectrum, the magnitude would be small by a factor of 'two' [for
amplitude, and 2^2=4 for power spectrum], when compared with that from
'ezfftf'. See the example below - in the example, I used [N/2],
instead of [N], just to match the power spectra, but then the average
needs to be divided by 'two'.
Please let us know whether this is correct [in this case, there will
also be a 2^2 factors in the examples of the "space-time spectra" in
Wheeler-Kiladis Space-Time Spectra that use 'cfftf'].
Thanks.
=======
begin
x = (/ 1002, 1017, 1018, 1020, 1018, 1027, \
1028, 1030, 1012, 1012, 982, 1012, \
1001, 996, 995, 1011, 1027, 1025, \
1030, 1016, 996, 1006, 1002, 982 /)
N = dimsizes(x)
df = 1.0/N
xAvg = avg(x)
print ("N="+N+" df="+df+" avg(x)="+xAvg)
cf = cfftf (x, 0.0, 0) ; imaginary part set to 0.0
printVarSummary(cf)
cf = cf/N*2
print(sprintf("%9.5f", cf@frq) +" "+sprintf("%9.3f", cf(0,:))+"
"+sprintf("%9.3f", cf(1,:)) )
cf_ezfftf = ezfftf (x)
print(cf_ezfftf)
power = new ((/N/), "float")
power = sqrt((cf(0,:)^2 + cf(1,:)^2))
print(power)
power_ezfftf = new ((/N/2/), "float")
power_ezfftf = sqrt((cf_ezfftf(0,:)^2 + cf_ezfftf(1,:)^2))
print(power_ezfftf)
end
=========
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 2 13:40:10 2012
This archive was generated by hypermail 2.1.8 : Thu Feb 09 2012 - 13:33:26 MST