3 bit binary signal to numerical value

I have a 32768x3 double array that contains a 3 bit binary signal. I want to convert this 3 bit binary signal to a value between 1 and -1. For example:
111 ----- 0.75
110 ----- 0.5
101 ----- 0.25
100 ----- 0
011 ----- -0.25
010 ----- - 0.5
001 ----- - 0.75
000 ----- - 1
I want to store the results in a 32768x1 array
Thank you

 採用された回答

Walter Roberson
Walter Roberson 2019 年 9 月 9 日

2 投票

YourArray(:,1) + YourArray(:,2) / 2 + YourArray(:,3) / 4 - 1

2 件のコメント

Yusuf Dhoda
Yusuf Dhoda 2019 年 9 月 9 日
Thank you so much!
Adam Danz
Adam Danz 2019 年 9 月 9 日
Nice! +1

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by