Documentation Center

  • Trial Software
  • Product Updates

bitrevorder

Permute data into bit-reversed order

Syntax

y = bitrevorder(x)
[y,i] = bitrevorder(x)

Description

bitrevorder is useful for pre-arranging filter coefficients so that bit-reversed ordering does not have to be performed as part of an fft or inverse FFT (ifft) computation. This can improve run-time efficiency for external applications or for Simulink® blockset models. Both MATLAB® fft and ifft functions process linear input and output.

    Note   Using bitrevorder is equivalent to using digitrevorder with radix base 2.

y = bitrevorder(x) returns the input data in bit-reversed order in vector or matrix y. The length of x must be an integer power of 2. If x is a matrix, the bit-reversal occurs on the first dimension of x with size greater than 1. y is the same size as x.

[y,i] = bitrevorder(x) returns the bit-reversed vector or matrix y and the bit-reversed indices i, such that y = x(i). Recall that MATLAB matrices use 1-based indexing, so the first index of y will be 1, not 0.

The following table shows the numbers 0 through 7, the corresponding bits and the bit-reversed numbers.

Linear Index

Bits

Bit- Reversed

Bit-Reversed Index

0

000

000

0

1

001

100

4

2

010

010

2

3

011

110

6

4

100

001

1

5

101

101

5

6

110

011

3

7

111

111

7

Examples

Obtain the bit-reversed ordered output of a vector:

x=[0:7]';                % Create a column vector
[x,bitrevorder(x)]
%	ans =
%     0     0
%     1     4
%     2     2
%     3     6
%     4     1
%     5     5
%     6     3
%     7     7

See Also

| |

Was this topic helpful?