16 bit signed data to integer for analysis

2 visualizaciones (últimos 30 días)
Atique
Atique el 18 de Sept. de 2015
Comentada: Walter Roberson el 18 de Sept. de 2015
Hi, I am trying to convert 16 bit signed data from my machine to convert to radians. I am a bit confused as to how I can convert per say +1024 into 2pi and -1024 into -2pi. Is there a function that can first convert the 16bit signed data into real number for me?
Thanks, Atique

Respuesta aceptada

Walter Roberson
Walter Roberson el 18 de Sept. de 2015
Editada: Walter Roberson el 18 de Sept. de 2015
double(X)/1024 * 2*pi
However, normally angles are in the range -Pi to +Pi or 0 to 2*Pi. If you wanted -1024 to correspond to -Pi and +1024 to correspond to +Pi then change the 2*pi above to just pi
  2 comentarios
Atique
Atique el 18 de Sept. de 2015
Thanks! I didn't realize there was no conversion needed!
Walter Roberson
Walter Roberson el 18 de Sept. de 2015
double() does conversion.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by