Conversion of signed binary row matrix in to decimal value

1 visualización (últimos 30 días)
Ayesa
Ayesa el 22 de Dic. de 2011
If i have a 1 by 16 matrix where each element representing a bit and the matrix is a representation of singned binary number. p = [1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1]
I want to put a radix point n bits from the LSB and convert it in to decimal value (here, n = 2; p = -12.25 after decimal conversion).
How can i do that? Can anyone please give me any suggestion?

Respuestas (1)

Walter Roberson
Walter Roberson el 22 de Dic. de 2011
Start with code to do the conversion of the bits in to decimal. Once you have that code, feed p(2) to the end in to that, divide the result by 2^n, and then use the first bit, p(1) to do the sign adjustment.
  2 comentarios
Ayesa
Ayesa el 22 de Dic. de 2011
Thanks for your answer. How can i convert bits in to decimal? Can you please give me any idea?
Walter Roberson
Walter Roberson el 22 de Dic. de 2011
How would you do it on paper?

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by