kvanbrunt
02-10-2005, 03:25 PM
:confused:
I am trying to use four1 (in fortran). I am using a gaussian as the input, f(t) = exp(-t**2/2.0), from 0 < t < 4, and delta, the spacing between data points, is 1.0. I am using Figure 12.2.2 on page 502 to find the input array and the frequencies for the output array.
Therefore, my input array is:
data(1) = exp (0) = 1.0
data(2) = 0.0 = data(4) = data(6) = data(8), since there are no complex parts to the input function.
data(3) = exp(-0.5) = 0.606531
data(5) = exp(-2.0) = 0.135335
data(7) = exp(-4.5) = 1.11090E-02
I believe the analytical fourier transform of this function is:
F(f) = sqrt(2*pi) * exp(-2.0*pi**2*f**2)
f = n/N*delta
fo = 0
f1 = 0.25
f2 = 0.5
f3 = -0.25
So, F(0) = 2.50663
F (0.25) = 0.729964
F(0.5) = 1.80275E-02
F (-0.25) = 0.729964
However, my first clue that something was wrong was that four1.f returned complex values for the fourier transform!
The output is:
1.75297 + 0i (data(1) & data(2))
0.864665 + 0.595422i (data(3) & data(4))
0.517696 + 0i (data(5) & data(6))
0.864665 - 0.595422i (data(7) & data(8))
It is obvious to me that I must be making some mistake in my input array, but it is not obvious what that mistake is! Can someone please help me sort this out!
Thanks!
A greatly confused & frtustrated graduate student
I am trying to use four1 (in fortran). I am using a gaussian as the input, f(t) = exp(-t**2/2.0), from 0 < t < 4, and delta, the spacing between data points, is 1.0. I am using Figure 12.2.2 on page 502 to find the input array and the frequencies for the output array.
Therefore, my input array is:
data(1) = exp (0) = 1.0
data(2) = 0.0 = data(4) = data(6) = data(8), since there are no complex parts to the input function.
data(3) = exp(-0.5) = 0.606531
data(5) = exp(-2.0) = 0.135335
data(7) = exp(-4.5) = 1.11090E-02
I believe the analytical fourier transform of this function is:
F(f) = sqrt(2*pi) * exp(-2.0*pi**2*f**2)
f = n/N*delta
fo = 0
f1 = 0.25
f2 = 0.5
f3 = -0.25
So, F(0) = 2.50663
F (0.25) = 0.729964
F(0.5) = 1.80275E-02
F (-0.25) = 0.729964
However, my first clue that something was wrong was that four1.f returned complex values for the fourier transform!
The output is:
1.75297 + 0i (data(1) & data(2))
0.864665 + 0.595422i (data(3) & data(4))
0.517696 + 0i (data(5) & data(6))
0.864665 - 0.595422i (data(7) & data(8))
It is obvious to me that I must be making some mistake in my input array, but it is not obvious what that mistake is! Can someone please help me sort this out!
Thanks!
A greatly confused & frtustrated graduate student