bitrevorder() - Signal Processing
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 IndexBitsBit- ReversedBit-Reversed
Index
00000000
10011004
20100102
30111106
41000011
51011015
61100113
71111117
Syntax
y = bitrevorder(x)[y,i] = bitrevorder(x)
Example
Vector in Bit-Reversed OrderOpen This Example
Create a column vector and obtain its bit-reversed version. Verify by displaying the elements as binary strings.
x = (0:15)';
v = bitrevorder(x);
x_bin = dec2bin(x);
v_bin = dec2bin(v);
T = table(x,x_bin,v,v_bin)
T =
x x_bin v v_bin
__ _____ __ _____
0 0000 0 0000
1 0001 8 1000
2 0010 4 0100
3 0011 12 1100
4 0100 2 0010
5 0101 10 1010
6 0110 6 0110
7 0111 14 1110
8 1000 1 0001
9 1001 9 1001
10 1010 5 0101
11 1011 13 1101
12 1100 3 0011
13 1101 11 1011
14 1110 7 0111
15 1111 15 1111
Output / Return Value
Limitations
Alternatives / See Also
Reference