Re: fft2 filtering real vs complex question
- From: illywhacker <illywacker@xxxxxxxxx>
- Date: Mon, 2 Feb 2009 03:01:11 -0800 (PST)
On Jan 31, 7:54 pm, Steve <ssheri...@xxxxxxxxx> wrote:
I have a real valued 2D array of magnetic observations F which I am
working with in Matlab.
ifft2(fft2(F))= real, as expected.
I want to calculate the first vertical integral of those data to get
the magnetic potential which should be real as well. That requires
dividing by the wavenumber array.
vertInt=ifft2(fft2(F)./wn)
This yields a complex array. I think the result should be real. The
negative and positive values of the result are equally important so
looking at abs(ifft2(fft2(F))) doesn’t help.
In short, I expect vertInt to be real, it isn’t. Any help on where I
am going wrong will be greatly appreciated.
You need to specify exactly what the array wn is to get an answer. In
the discrete Fourier basis, discrete wave numbers are only defined
modulo the number of points, but this is no longer quite true once you
start dividing by them. There are a couple of ways to see why this is
so.
1) In dividing by them you are attempting to approximate the inverse
of the continuous y differential. Thus your discrete expression should
(at least) tend to the continuous one as the sampling grid spacing
shrinks to zero. This requires to use the -N/2:N/2 type convention to
define the wave numbers.
2) Alternatively, you stay within the discrete domain, and instead
look for the inverse of the discrete difference operator in the
vertical direction. This operator is indeed diagonalized in the
discrete Fourier domain, but you need its eigenvalues. These are not
given by the wave number, but rather by
exp(i 2 pi m / N) - 1
where N is the number of points, and m is the wave number (in the
vertical direction in this case). Note that these are invariant to
shifts of m by N. Note, though, that to take the small m/N limit (to
get the continuous case) is tricky. If you are using the 0:(N - 1)
convention for the wave numbers, you need to take into account that
values of m close to N also give values of the exponential very close
to 1, and so need to be taken into account in addition to values of m
close to 0. This is because the frequency domain is really a torus.
illywhacker;
.
- Prev by Date: Re: 2D FFT
- Next by Date: Re: fft2 filtering real vs complex question
- Previous by thread: QPSK Demodulator testing
- Next by thread: Re: fft2 filtering real vs complex question
- Index(es):
Relevant Pages
|