Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem with 3d fft on a complex number array

Subject: problem with 3d fft on a complex number array

From: Annea Barkefors

Date: 1 Sep, 2009 09:48:01

Message: 1 of 2

Hi!

I'm trying to do a 3d fft on a 3d array of data, representing several images laying 'on top' of each other. Then I'm doing some stuff with the transformed data and transform it back with inverse fft. My problem is that when looking at the pictures I get out from my algoritm, they turn out up side down, and I'm having problem figuring out why. I'm using the command

fftn(X),

and have also tried with

fft(fft(fft(X,[],1),[],2),[],3)

and I find they give the same result. However, to check my result I calculated the zero frequency as

sum(sum(sum(X)))

and compared this with the zero frequency of my filtered data, and they don't match up. My array is made up of complex numbers, and when I try the fftn function on an array with real numbers, it works just fine. Also, if I take only one of my images, which means a 2d matrix with complex numbers, and transform that one using fft2 instead, then the zero frequency gets correct.

Does anybody know what I'm doing wrong?

Subject: problem with 3d fft on a complex number array

From: Thomas Clark

Date: 22 Dec, 2009 14:09:04

Message: 2 of 2

Annea,

Sorry, this might be too late.

I just thought the root of the problem might be to do with the ordering of the output. Have a look at the fftshift and ifftshift commands to figure out whereabouts your DC component should be located.

Hope this helps

Tom Clark

"Annea Barkefors" <anba1944@student.uu.se> wrote in message <h7iqkh$3pr$1@fred.mathworks.com>...
> Hi!
>
> I'm trying to do a 3d fft on a 3d array of data, representing several images laying 'on top' of each other. Then I'm doing some stuff with the transformed data and transform it back with inverse fft. My problem is that when looking at the pictures I get out from my algoritm, they turn out up side down, and I'm having problem figuring out why. I'm using the command
>
> fftn(X),
>
> and have also tried with
>
> fft(fft(fft(X,[],1),[],2),[],3)
>
> and I find they give the same result. However, to check my result I calculated the zero frequency as
>
> sum(sum(sum(X)))
>
> and compared this with the zero frequency of my filtered data, and they don't match up. My array is made up of complex numbers, and when I try the fftn function on an array with real numbers, it works just fine. Also, if I take only one of my images, which means a 2d matrix with complex numbers, and transform that one using fft2 instead, then the zero frequency gets correct.
>
> Does anybody know what I'm doing wrong?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us