ezfftf

From: Wolfgang Langhans <wolfgang.langhans_at_nyahnyahspammersnyahnyah>
Date: Fri Dec 02 2011 - 02:01:21 MST

Hi,

I am a bit confused about the outcome of the ezfftf Fourier Forward
analysis. Should not the sum over all squared norms equal the total
biased variance of the data series? How can I understand the different
results obtained in the little example below? How comes that the sum
amounts almost twice the actual variance?

Thanks for your help in understanding this!
Wolfgang

;======================================================
  low = -5.0
  high = 5.0
  con = (high - low) / 32766.0 ; 32766.0 forces a 0.0 to 1.0 range
  Z = new(100,float)
  do i=0,dimsizes(Z)-1
    Z(i) = low + con * rand()
  end do

  zmean = avg(Z)
  zvarbiased = 1./dimsizes(Z) * sum( (Z-zmean)^2 ) ;total biased
variance of original data

  zfft = ezfftf(Z)
  z = zfft(0,:)^2 + zfft(1,:)^2
  nfreq = dimsizes(z)
  totvar = sum(z(0:nfreq-1)) ; sum over all squared norms of the
complex Fourier transforms

  print("Variance: "+ zvarbiased + " Sum over spectrum: "+totvar )
;======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Dec 2 02:01:35 2011

This archive was generated by hypermail 2.1.8 : Fri Dec 02 2011 - 16:10:18 MST