summaryrefslogtreecommitdiff
path: root/lib/analytic.f90
blob: 33d5fc740bd0aeae4994b377c404fca02e7b4084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
subroutine analytic(d,npts,nfft,s,c)

! Convert real data to analytic signal

  parameter (NFFTMAX=128*1024)
  real d(npts)
  real s(npts)
  complex c(NFFTMAX)

  nh=nfft/2
  fac=2.0/nfft
  c(1:npts)=fac*d(1:npts)
  c(npts+1:nfft)=0.
  call four2a(c,nfft,1,-1,1)               !Forward c2c FFT

  do i=1,nh
     s(i)=real(c(i))**2 + aimag(c(i))**2
  enddo

  c(1)=0.5*c(1)
  c(nh+2:nfft)=0.
  call four2a(c,nfft,1,1,1)                !Inverse c2c FFT

  return
end subroutine analytic