Cuestion 9 (Aritmetica, codigo Gray)

Image 2005Jun2EC9
Solucion:
$B_{6}$ $B_{5}$ $B_{4}$ $B_{3}$ $B_{2}$ $B_{1}$
1 1 1 0 0 1

\begin{displaymath}G_{i_{max}}=B_{i_{max}}\end{displaymath}


\begin{displaymath}G_i=B_{i+1}\oplus B_{i}\end{displaymath}




\begin{displaymath}B_{6}=G_{6}=1\end{displaymath}


\begin{displaymath}G_5=B_{6}\oplus B_{5}=1\oplus 1=0\end{displaymath}


\begin{displaymath}G_4=B_{5}\oplus B_{4}=1\oplus 1=0\end{displaymath}


\begin{displaymath}G_3=B_{4}\oplus B_{3}=1\oplus 0=1\end{displaymath}


\begin{displaymath}G_2=B_{3}\oplus B_{2}=0\oplus 0=0\end{displaymath}


\begin{displaymath}G_1=B_{2}\oplus B_{1}=0\oplus 1=1\end{displaymath}



Con lo que la transformacion de binario a codigo de Gray sera 100101.


Vamos a comprobarlo con el Mathematica:

conversionBinarioGray[a_] := {a1 := IntegerDigits[a,2,7];
  l1 := Length[a1]; b2 = a1; a4 = a1[[1]];
  Do[b2[[i]] = BitXor[a1[[i]], a4]; a4 = a1[[i]], {i, 2, l1}];
  Print[b2]}

conversionBinarioGray[2^^111001]




2011-07-31