main content

fast fourier transform (fft) of input -凯发k8网页登录

fast fourier transform (fft) of input

  • fft block

libraries:
dsp system toolbox / transforms

description

the fft block computes the fast fourier transform (fft) across the first dimension of an n-d input array, u. the block uses one of two possible fft implementations. you can select an implementation based on the fftw library or an implementation based on a collection of radix-2 algorithms. to allow the block to choose the implementation, you can select auto. for more information about the fft implementations, see algorithms.

for user-specified fft lengths not equal to p, zero padding or truncating, or modulo-length data wrapping occurs before the fft operation. for an fft with pm:

y = fft(u,m) % p ≤ m

wrapping:

y(:,l) = fft(datawrap(u(:,l),m)) % p > m; l = 1,...,n

truncating:

y (:,l) = fft(u,m) % p > m; l = 1,...,n

tip

when the input length, p, is greater than the fft length, m, you may see magnitude increases in your fft output. these magnitude increases occur because the fft block uses modulo-m data wrapping to preserve all available input samples.

to avoid such magnitude increases, you can truncate the length of your input sample, p, to the fft length, m. to do so, place a block before the fft block in your model.

examples

ports

input

input signal for computing the fft. the block computes the fft along the first dimension of the n-d input signal.

for more information on how the block computes the fft, see description and algorithms.

data types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point
complex number support: yes

output

the fft, computed across the first dimension of an n-d input array. when the output of the block has an integer or fixed-point data type, it is always signed.

the kth entry of the lth output channel, y(k,l), equals the kth point of the m-point discrete fourier transform (dft) of the lth input channel:

y(k,l)=p=1pu(p,l)ej2π(p1)(k1)/mk=1,,m

for more information on how the block computes the fft, see description and algorithms.

data types: single | double | int8 | int16 | int32 | fixed point
complex number support: yes

parameters

main

set this parameter to fftw to support an arbitrary length input signal. the block restricts generated code with fftw implementation to host computers capable of running matlab®.

set this parameter to radix-2 for bit-reversed processing, fixed or floating-point data, or portable c-code generation using the simulink® coder™. the dimension m of the m-by-n input matrix, must be a power of two. to work with other input sizes, use the block to pad or truncate these dimensions to powers of two, or if possible choose the fftw implementation. for more information about the algorithms used by the radix-2 mode, see radix-2 implementation.

set this parameter to auto to let the block choose the fft implementation. for floating-point inputs with non-power-of-two transform lengths, the fftw algorithm is automatically chosen. otherwise a radix-2 algorithm is automatically chosen. for non-power-of-two transform lengths, the block restricts generated code to matlab host computers.

designate the order of the output channel elements relative to the ordering of the input elements. when you select this check box, the output channel elements appear in bit-reversed order relative to the input ordering. if you clear this check box, the output channel elements appear in linear order relative to the input ordering.

note

the fft block calculates its output in bit-reversed order. linearly ordering the fft block output requires an extra bit-reversal operation. in many situations, you can increase the speed of the fft block by selecting the output in bit-reversed order check box.

for more information ordering of the output, see .

dependencies

to enable this parameter, set fft implementation to auto or radix-2.

when you select this parameter, the block divides the output of the fft by the fft length. this option is useful when you want the output of the fft to stay in the same amplitude range as its input. this is particularly useful when working with fixed-point data types.

select to inherit the fft length from the input dimensions. when you select this check box, the input length must be a power of two.

dependencies

when you do not select this check box, the fft length parameter becomes available to specify the length.

specify fft length as an integer greater than or equal to two.

when you set the fft implementation parameter to radix-2, or when you check the output in bit-reversed order check box, this value must be a power of two.

dependencies

to enable this parameter, clear the inherit fft length from input dimensions check box.

choose to wrap or truncate the input, depending on the fft length. if you select this parameter, modulo-length data wrapping occurs before the fft operation when the fft length is shorter than the input length. if you clear this check box, truncation of the input data to the fft length occurs before the fft operation.

dependencies

to enable this parameter, clear the inherit fft length from input dimensions check box.

data types

select the rounding mode for fixed-point operations.

limitations

the sine table values do not obey this parameter; instead, they always round to nearest.

the rounding mode parameter has no effect on numeric results when all these conditions are met:

  • product output data type is inherit: inherit via internal rule.

  • accumulator data type is inherit: inherit via internal rule.

with these data type settings, the block operates in full-precision mode.

when you select this parameter, the block saturates the result of its fixed-point operation. when you clear this parameter, the block wraps the result of its fixed-point operation. for details on saturate and wrap, see overflow mode for fixed-point operations.

limitations

the saturate on integer overflow parameter has no effect on numeric results when all these conditions are met:

  • product output data type is inherit: inherit via internal rule.

  • accumulator data type is inherit: inherit via internal rule.

with these data type settings, the block operates in full-precision mode.

choose how to specify the word length of the values of the sine table. the fraction length of the sine table values always equals the word length minus one. you can set this parameter to:

  • a rule that inherits a data type, for example, inherit: same word length as input

  • an expression that evaluates to a valid data type, for example, fixdt(1,16)

click the show data type assistant button to display the data type assistant, which helps you set the sine table parameter.

see (simulink) for more information.

limitations

the sine table values do not obey the rounding mode and saturate on integer overflow parameters; instead, they are always saturated and rounded to nearest.

specify the product output data type. see fixed point and for illustrations depicting the use of the product output data type in this block. you can set this parameter to:

  • a rule that inherits a data type, for example, inherit: inherit via internal rule. for more information on this rule, see inherit via internal rule.

  • an expression that evaluates to a valid data type, for example, fixdt(1,16,0)

click the show data type assistant button to display the data type assistant, which helps you set the product output parameter.

see (simulink) for more information.

specify the accumulator data type. see fixed point for illustrations depicting the use of the accumulator data type in this block. you can set this parameter to:

  • a rule that inherits a data type, for example, inherit: inherit via internal rule. for more information on this rule, see inherit via internal rule.

  • an expression that evaluates to a valid data type, for example, fixdt(1,16,0)

click the show data type assistant button to display the data type assistant, which helps you set the accumulator parameter.

see (simulink) for more information.

specify the output data type. see fixed point for illustrations depicting the use of the output data type in this block. you can set this parameter to:

  • a rule that inherits a data type, for example, inherit: inherit via internal rule.

    when you select inherit: inherit via internal rule, the block calculates the output word length and fraction length automatically. the equations that the block uses to calculate the ideal output word length and fraction length depend on the setting of the divide output by fft length check box.

    • when you select the divide output by fft length check box, the ideal output word and fraction lengths are the same as the input word and fraction lengths.

    • when you clear the divide output by fft length check box, the block computes the ideal output word and fraction lengths according to the following equations:

      wlideal output=wlinput floor(log2(fft length1)) 1

      flideal output=flinput

    using these ideal results, the internal rule then selects word lengths and fraction lengths that are appropriate for your hardware. for more information, see inherit via internal rule.

  • an expression that evaluates to a valid data type, for example, fixdt(1,16,0)

click the show data type assistant button to display the data type assistant, which helps you set the output parameter.

see (simulink) for more information.

specify the minimum value that the block should output. the default value is [] (unspecified). simulink software uses this value to perform:

  • simulation range checking (see (simulink))

  • automatic scaling of fixed-point data types

specify the maximum value that the block should output. the default value is [] (unspecified). simulink software uses this value to perform:

  • simulation range checking (see (simulink))

  • automatic scaling of fixed-point data types

select this parameter to prevent the fixed-point tools from overriding the data types you specify in the block dialog box.

block characteristics

data types

double | fixed point | integer | single

direct feedthrough

no

multidimensional signals

yes

variable-size signals

yesa

zero-crossing detection

no

a variable-size signals are only supported when the inherit fft length from input dimensions checkbox is selected.

algorithms

references

[1] orfanidis, s. j. introduction to signal processing. upper saddle river, nj: prentice hall, 1996, p. 497.

[2] proakis, john g. and dimitris g. manolakis. digital signal processing, 3rd ed. upper saddle river, nj: prentice hall, 1996.

[3] fftw ()

[4] frigo, m. and s. g. johnson, “fftw: an adaptive software architecture for the fft,”proceedings of the international conference on acoustics, speech, and signal processing, vol. 3, 1998, pp. 1381-1384.

extended capabilities

version history

introduced before r2006a

see also

objects

functions

  • | |

blocks

  • | |

topics

    网站地图