I used it for building sequency of Hadamard matrix of order N.
function SeqOrd = GetSequency( N )
% N - [in] the order of Hadamard matrix
% SeqOrd - [out] the sequency, so that SeqOrd[i] is the sequency of row i
% 1. build a list of indexes 0..N-1
% 2. convert order of bits of each index
% 3. get the gray code value for each index ( that was converted)
% This gives the needed permutation with indexes range [0 .. N-1]
v = bitrevorder((0:N-1)'); % build list and reverse bit-order
SeqOrd = bitxor(v,bitshift(v,-1)); % find the gray-code
08 Oct 2008
11 Jul 2007
can we convert a matrix? yeh whatever, served the purpose for me!
28 Feb 2007
Excellent solution. Thanks!
24 Sep 2005
why not do like this: