2-D FFT - Compute 2-D FFT of input

Library

Transforms

Description

The 2-D FFT block computes the fast Fourier transform (FFT) of a two-dimensional M-by-N input matrix in two steps. First it computes the one-dimensional FFT along one dimension (row or column). Then it computes the FFT of the output of the first step along the other dimension (column or row). The dimensions of the input matrix, M and N, must be powers of two. To work with other input sizes, use the Pad block to pad or truncate these dimensions to powers of two.

The output of the 2-D FFT block is equivalent to the MATLAB® fft2 function:

y = fft2(A)					% Equivalent MATLAB code

Computing the FFT of each dimension of the input matrix is equivalent to calculating the two-dimensional discrete Fourier transform (DFT), which is defined by the following equation:

where and .

PortInput/OutputSupported Data TypesComplex Values Supported

Input

Vector or matrix of intensity values

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • 8-, 16-, 32-bit signed integer

  • 8-, 16-, 32-bit unsigned integer

Yes

Output

2-D FFT of the input

Same as Input port

Yes

If the data type of the input signal is floating point, the data type of the output signal is the same floating-point data type. Otherwise, the output can be any fixed-point data type.

Optimizing the Table of Trigonometric Values

The block computes all the possible trigonometric values of the twiddle factor

where K is the greater value of either M or N and . The block stores these values in a table and retrieves them during simulation. You can optimize the table of trigonometric values for memory or speed using the Optimize table for parameter. This parameter varies the number of table entries as summarized in the following table.

Optimize Table for Parameter Setting

Number of Table Entries for N-Point FFT

Speed

3N/4 -- floating point

N -- fixed point

Memory

N/4 -- floating point

Not supported for fixed point

Ordering Output Column Entries

Use the Output in bit-reversed order parameter to specify the ordering of the column elements of the output as either linear or bit-reversed. If you select the Output in bit-reversed order check box, the row and column elements are output in bit-reversed order. This means that the mth row element is located at the kth position, where k is the bit reversed value of m. Also, the nth column element is located at the lth position, where l is the bit reversed value of n. If you clear the Output in bit-reversed order check box, the channel elements are output in linear order.

For more information ordering of the output, see Bit-Reversed Order. The 2-D FFT block bit-reverses the order of the columns as well as the rows.

Algorithms Used for FFT Computation

Depending on whether the block input is floating-point or fixed-point, real or complex, and whether you want the output in linear or bit-reversed order, the block uses one or more of the following algorithms as summarized in the following tables:

Floating-Point Signals

Complexity of Input

Output Ordering

Algorithms Used for FFT Computation

Complex

Linear

Butterfly operation and radix-2 DIT

Complex

Bit-reversed

Radix-2 DIF

Real

Linear

Butterfly operation and radix-2 DIT in conjunction with the half-length and double-signal algorithms

Real

Bit-reversed

Radix-2 DIF in conjunction with the half-length and double-signal algorithms

Fixed-Point Signals

Complexity of Input

Output Ordering

Algorithms Used for FFT Computation

Real or complex

Linear

Butterfly operation and radix-2 DIT

Real or complex

Bit-reversed

Radix-2 DIF

Fixed-Point Data Types

The following diagrams show the data types used in the 2-D FFT block for fixed-point signals. You can set the sine table, accumulator, product output, and output data types displayed in the diagrams in the 2-D FFT dialog box as discussed in Dialog Box.

Inputs to the 2-D FFT block are first cast to the output data type and stored in the output buffer. Each butterfly stage then processes signals in the accumulator data type, with the final output of the butterfly being cast back into the output data type. A twiddle factor is multiplied in before each butterfly stage in a decimation-in-time FFT, and after each butterfly stage in a decimation-in-frequency FFT.

The output of the multiplier is in the accumulator data type since both of the inputs to the multiplier are complex. For details on the complex multiplication performed, refer to Multiplication Data Types in the Signal Processing Blockset™ documentation.

Example

Bit-Reversed Order

Two numbers are bit-reversed values of each other when the binary representation of one is the mirror image of the binary representation of the other. For example, in a three-bit system, one and four are bit-reversed values of each other, since the three-bit binary representation of one, 001, is the mirror image of the three-bit binary representation of four, 100. In the following diagram, the row indices are in linear order. To put them in bit-reversed order

  1. Translate the indices into their binary representation with the minimum number of bits. In this example, the minimum number of bits is three because the binary representation of 7 is 111.

  2. Find the mirror image of each binary entry, and write it beside the original binary representation.

  3. Translate the indices back to their decimal representation.

    The row indices are now in bit-reversed order.

If, on the 2-D FFT block parameters dialog box, you select the Output in bit-reversed order check box, the block bit-reverses the order of the columns as well as the rows. The next diagram illustrates the linear and bit-reversed outputs of the 2-D FFT block. The output values are the same, but they appear in different order.

Dialog Box

The Main pane of the 2-D FFT dialog box appears as shown in the following figure.

Optimize table for

Optimize the table of twiddle factor values for Speed or Memory. This parameter must be set to Speed for fixed-point signals.

Output in bit-reversed order

Designate the order of the output channel elements relative to the ordering of the input elements. When selected, the output channel elements are in bit-reversed order relative to the input ordering. Otherwise, the output column elements are linearly ordered relative to the input ordering. Linearly ordering the output requires extra data sorting manipulation. For more information, see Bit-Reversed Order.

The Fixed-point pane of the 2-D FFT dialog box appears as shown in the following figure.

Rounding mode

Select the rounding mode for fixed-point operations. The sine table values do not obey this parameter; they always round to Nearest.

Overflow mode

Select the overflow mode for fixed-point operations. The sine table values do not obey this parameter; they are always saturated.

Skip divide-by-two on butterfly outputs for fixed-point signals

When this parameter is selected, no scaling occurs. When this parameter is not selected, the output of each butterfly of the FFT is divided by two for fixed-point signals.

Sine table

Choose how to specify the word length of the values of the sine table. The fraction length of the sine table values is always equal to the word length minus one:

The sine table values do not obey the Rounding mode and Overflow mode parameters; they are always saturated and rounded to Nearest.

Product output

Use this parameter to specify how to designate the product output word and fraction lengths. Refer to Fixed-Point Data Types and Multiplication Data Types in the Signal Processing Blockset documentation for illustrations depicting the use of the product output data type in this block:

Accumulator

Use this parameter to specify how to designate the accumulator word and fraction lengths. Refer to Fixed-Point Data Types and Multiplication Data Types in the Signal Processing Blockset documentation for illustrations depicting the use of the accumulator data type in this block:

Output

Choose how to specify the output word length and fraction length:

See Also

2-D DCT

Video and Image Processing Blockset

2-D IDCT

Video and Image Processing Blockset

2-D IFFT

Video and Image Processing Blockset

FFT

Signal Processing Blockset

IFFT

Signal Processing Blockset

Pad

Signal Processing Blockset

bitrevorder

Signal Processing Toolbox

fft

Signal Processing Toolbox

ifft

Signal Processing Toolbox

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS