🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.idl-pvwave
Article #331

Re: problems with FFT cross spectra and other floating point operations

#331
From: Ferhat F. Hatay
Date: Thu, 17 Dec 1992 17:33
54 lines
2638 bytes
In article <1992Dec17.030946.4899@news.media.mit.edu>   steve@media.mit.edu (Steve Mann) writes:
.
.
.
>  
>  I also noticed that when I subtract the DC from an image, and then do
>  an FFT, the element af(0,0) is not always zero.  In fact, as the image
>  gets bigger, I get values further and further from zero.  For a 256 by 265
>  image, the DC spike in the Fourier domain is so high that I can't see 
>  anything else in shade_surf,abs(af) or tvscl,abs(af).
>  
>  I wrote this little script which shows the accumulation of excess DC:
>  --------------------------------------------------------------------------
>  ; when I set N=91 or less, I get zero as expected.
>  ; when I set N=92 or more, I get a non-zero DC value in fft.
>  
>  N = 100;  size of square array
>  q=findgen(N)#findgen(N); create some arbitrary square array
>  ;Subtract the DC component
>  w=float(q)-norm(q,/one)/float((size(q))(1))/float((size(q))(2))
>  wf = fft(w,1);      Fourier transform of w
>  print,wf(0,0);      The DC component should be zero now.
>  ;I dont know why it is not zero.


I was under the impression that the FFT routines in IDL and WAVE
are basically one-dimensional-complex FFT routines. Please, forward me
info if this is wrong. 

I have played with one-d arrays of size 100-500 on IDL.  here is the script:

IdlMaster>  N=100
IdlMaster>  q = findgen(N)  
IdlMaster>  w = q-total(q)/float(N)
IdlMaster>  wf=fft(w,1)
IdlMaster>  print,wf(0,0)
(      0.00000,      0.00000)
IdlMaster>  print,total(w),total(q)
      0.00000      4950.00

IdlMaster>  N=500
IdlMaster>  q = findgen(N)
IdlMaster>  w = q-total(q)/float(N)
IdlMaster>  wf=fft(w,1)  
IdlMaster>  print,wf(0,0)
(      0.00000,      0.00000)
IdlMaster>  print,total(w),total(q)
      0.00000      124750.

-- 
Ferhat F. Hatay                        || Disclamer: |||||||||||||||||
Aerospace Engineering Sciences         || I speak for myself unless || 
University of Colorado, Boulder        || otherwise indicated.      ||
e-mail: hatay@spot.colorado.edu        |||||||||||||||||||||||||||||||
Technical Details
Message-ID: <1992Dec17.173344.10402@ucsu.Colorado.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!boulder!ucsu!spot.Colorado.EDU!hatay
References: <1992Dec17.030946.4899@news.media.mit.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.idl-pvwave
Path: arc1-ca.pugleaf.net!sparky!uunet!boulder!ucsu!spot.Colorado.EDU!hatay
From: hatay@spot.Colorado.EDU (Ferhat F. Hatay)
Subject: Re: problems with FFT cross spectra and other floating point operations
Message-ID: <1992Dec17.173344.10402@ucsu.Colorado.EDU>
Sender: news@ucsu.Colorado.EDU (USENET News System)
Nntp-Posting-Host: spot.colorado.edu
Organization: University of Colorado, Boulder
References: <1992Dec17.030946.4899@news.media.mit.edu>  
Date: Thu, 17 Dec 1992 17:33:44 GMT
Lines: 54