comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Complications with variance using FFTs
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Complications with variance using FFTs [message #40166] Fri, 16 July 2004 11:08
olde_english33 is currently offline  olde_english33
Messages: 7
Registered: June 2004
Junior Member
First I computed the FFT of a recorded time series. I then computed
the spectrum of this time series to keep the amplitudes of the
original data. I then wanted to tie in a random phase because I want
to give variables the same kind of shape when I inverse transform.
Here is a sample of my code:

for i=0,12 do begin
Xf1[*,i]=fft(xf1[*,i])*31.0
Xf2[*,i]=fft(xf2[*,i])*31.0
specx1[*,i]=Xf1[*,i]*conj(Xf1[*,i])/31.0
specx2[*,i]=Xf2[*,i]*conj(Xf2[*,i])/31.0
endfor

for i=0,30 do begin
avgspec1=mean(spec1[i,*])
avgspec2=mean(spec2[i,*])
endfor

for j=0,99 do begin
ggg=randomu(5*j*!PI,15)
hhh[0]=0.0
hhh[1:15]=ggg
for k=0,14 do begin
hhh[30-k]=ggg[k]
endfor
aaa[*,j]=(randomu(2*j+3,31)-0.5)*sqrt(12.0)
bbb[*,j]=fft(aaa[*,j])
ccc1[*,j]=bbb[*,j]*exp(2.0*!PI*hhh*imag)
ccc2[*,j]=bbb[*,j]*exp(2.0*!PI*hhh*imag)
ddd1[*,j]=(fft(ccc1[*,j],1))
ddd2[*,j]=(fft(ccc2[*,j],1))
endfor

My dilemma is that the average sample variances of the generated time
series ddd1 and ddd2 are nowhere close to the average sample variance
of the orginal time series xf1 and xf2. A colleague and I have
narrowed it down to the fact that we are multiplying the spectrum by a
random phase which is throwing off the variance but I don't know how
to counteract this problem. Can anyone help???
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL FFT Source Code
Next Topic: Re: Filtering based on Hessian Matrix

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:11:02 PDT 2025

Total time taken to generate the page: 0.00521 seconds