# fft question

Started by July 30, 2010
```hi,

can anyone tell me how to perform 2d fft? what i understood for 2d fft
is that for each rows we perform individual fft's and place the result
on the respective rows and similarly for the columns. what i mean is
suppose i have an array of 2d data as:

0000
0110
0110
0000

now what i am trying to do is calculate fft (4 point fft instead of 16
point fft) of the first row (0000) and place the result in first row,
calculate the fft for the second row (0110) and place the result in
second row and so on. similarly for column calculate the fft for first
column (0000) and place the result in the first column and so on. so
will this work and will i get the same result as of 16 point fft?

thanks
```
```niyander <mightycatniyander@gmail.com> wrote:

> can anyone tell me how to perform 2d fft? what i understood for 2d fft
> is that for each rows we perform individual fft's and place the result
> on the respective rows and similarly for the columns. what i mean is
> suppose i have an array of 2d data as:

> 0000
> 0110
> 0110
> 0000

The FFT is separable in rectangular coordinates.  You separately
do the X and Y transforms, in either order, to get the appropriate
XY (2D) transform.

> now what i am trying to do is calculate fft (4 point fft instead of 16
> point fft) of the first row (0000) and place the result in first row,
> calculate the fft for the second row (0110) and place the result in
> second row and so on. similarly for column calculate the fft for first
> column (0000) and place the result in the first column and so on. so
> will this work and will i get the same result as of 16 point fft?

No, it is different from a 16 point 1D FFT on the data, but it
is the right transform for 2D data.

If you think about the normal modes for a square drum head
then you will have some idea about the results of the transform.

-- glen
```
```On Jul 30, 5:34=A0pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> niyander <mightycatniyan...@gmail.com> wrote:
> > can anyone tell me how to perform 2d fft? what i understood for 2d fft
> > is that for each rows we perform individual fft's and place the result
> > on the respective rows and similarly for the columns. what i mean is
> > suppose i have an array of 2d data as:
> > 0000
> > 0110
> > 0110
> > 0000
>
> The FFT is separable in rectangular coordinates. =A0You separately
> do the X and Y transforms, in either order, to get the appropriate
> XY (2D) transform.
>
> > now what i am trying to do is calculate fft (4 point fft instead of 16
> > point fft) of the first row (0000) and place the result in first row,
> > calculate the fft for the second row (0110) and place the result in
> > second row and so on. similarly for column calculate the fft for first
> > column (0000) and place the result in the first column and so on. so
> > will this work and will i get the same result as of 16 point fft?
>
> No, it is different from a 16 point 1D FFT on the data, but it
> is the right transform for 2D data.
>
> If you think about the normal modes for a square drum head
> then you will have some idea about the results of the transform.
>
> -- glen

Actually, what he is saying will not give the same result as a 2-D
fft.  After he fft's the rows, the first column is no longer (0000).

Dirk
```
```Dirk Bell <bellda2005@cox.net> wrote:
> On Jul 30, 5:34&#2013266080;pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
>> niyander <mightycatniyan...@gmail.com> wrote:
>> > can anyone tell me how to perform 2d fft? what i understood for 2d fft
>> > is that for each rows we perform individual fft's and place the result
>> > on the respective rows and similarly for the columns. what i mean is
>> > suppose i have an array of 2d data as:
>> > 0000
>> > 0110
>> > 0110
>> > 0000

>> The FFT is separable in rectangular coordinates. &#2013266080;You separately
>> do the X and Y transforms, in either order, to get the appropriate
>> XY (2D) transform.

(snip)

> Actually, what he is saying will not give the same result as a 2-D
> fft.  After he fft's the rows, the first column is no longer (0000).

Oh, that is what he meant?  No, you can't do that.

First you transform each row, leaving the result in that row.
Then, with the row results in each row, you transform each column.
(Or columns and then rows.)

Each element will then have an X and Y frequency, with one
corner being the (0,0) or DC term.  These correspond to the
possible vibrational modes of a square drum head.  The (0,0)
mode is the one where the whole drum surface moves up and down
together, and has the lowest frequency.  The (0,1) and (1,0)
modes are degenerate, that is, both have the same frequency,
such that any linear combination of them will also have that
frequency.

For a rectangular drum head with non-commensurate side lengths
there will be 16 different modes, all with different frequencies.
The (i,j) gives the number if X and Y nodes, respectively.

Well, you should actually use the sine transform for drum heads,
but the modes will be somewhat similar.

-- glen
```