Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > Digital Signal Processing (DSP) > another FFTW pr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 13304 of 14333
Post > Topic >>

another FFTW problem

by "jv_ju" <shuangyiju@[EMAIL PROTECTED] > Jul 3, 2008 at 03:20 PM

Hi, I am using FFTW to try another test, f(t)=exp(-x), x>=0, the real part
of the Fourier transforms should be 1/(1+x^2). I use xmax=1000, and
xmin=0,
let N=8192. I found the results seems ****fted upper, every output value is
larger than the analytical solution. 
My code is like this:
  program test

  implicit none

  include "fftw3.f"

  integer N
  parameter(N=8192)
  integer pi
  parameter(pi=3.14159265357)

  double complex in
  double complex out
  double precision f
  dimension out(N)
  dimension in(N)
  dimension f(N)

  integer i
  real*8 :: x,y,xmax,xmin,dx
  integer*8  plan

  OPEN(UNIT=7,FILE='fftin')
  OPEN(UNIT=8,FILE='fftout')

 ! write(*,*) 'Input array:'

  xmax=1000.
  xmin=0.
  dx=(xmax-xmin)/N

  write(6,*)
'XMAX',xmax,'xmin',xmin,'dx',dx,'N',N,'omega',1.0/(2.0*dx)*2*pi

   
   do i = 1,N/2+1
      x=xmin+dx*(i-1)
      in(i)=exp(-x)*(-1)**(i+1)
      if(i.gt.N/2+1) in(i)=0.0
   enddo
   do i=1,N
      x=xmin+dx*(i-1)
      write(7,*) i,x,real(in(i)), imag(in(i))
   enddo
  close(7)


   !call dfftw_plan_r2r_1d (plan, N, in, out, fftw_r2hc, FFTW_ESTIMATE)
  !call dfftw_plan_dft_r2c_1d(plan,N,in,out,FFTW_ESTIMATE)
   call dfftw_plan_dft_1d (plan, N, in, out, FFTW_FORWARD, FFTW_ESTIMATE)

  call dfftw_execute(plan)

  !write(*,*) 'Output array:'

  do i = 1,N
     f(i)=(-N/2+i-1)/(N*dx)
     write(8,*)
i,f(i)*2*pi,real(out(i))*dx,imag(out(i))*dx,1./(1.+(f(i)*2.*pi)**2),-f(i)*2.*pi/(1.+(f(i)*2.*pi)**2)
  enddo
  close(8)
  STOP

can any one help me about it?
Thanks
 




 5 Posts in Topic:
another FFTW problem
"jv_ju" <shu  2008-07-03 15:20:48 
Re: another FFTW problem
Jerry Avins <jya@[EMAI  2008-07-03 17:09:18 
Re: another FFTW problem
"jv_ju" <shu  2008-07-10 15:19:53 
Re: another FFTW problem
Jerry Avins <jya@[EMAI  2008-07-12 15:52:58 
Re: another FFTW problem
"jv_ju" <shu  2008-07-10 15:57:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 6:31:50 CST 2008.