How to assign voltage levels to bit-groups?

I have a bitstream which I have grouped into 3-bits (8-ARY system). I want to assign voltage levels to these bits and plot the graph. I am aiming to assign the following voltage levels to their respective bits:
I am working on a generalization of assigning these voltage levels. For example, if I group the bits into 4-bits(16-ARY system), the voltage assigning would go like this:
How is it done in MATLAB?
Thanks.

5 Comments

See
doc bin2dec
or you can just use a lookup table from storing the string values in an array.
Should 1111 really be 16? What about 15?
dpb
dpb on 11 Jan 2021
Edited: dpb on 11 Jan 2021
Yeah, noticed that. Figured typo or just mistake--he got the 3-bit case right.
Yes thanks! it was a typo.
dpb, Afaq kindly "flagged" your comment as an answer and so he wants to give you credit for your help, but can't. So, can you more your answer to the Answers section below so he can do that for you? You should have way more reputation points than you, do but you keep putting your answers up here in the comment section so you can't get any credit for them.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Release

R2014a

Asked:

on 11 Jan 2021

Commented:

on 21 Jan 2021

Community Treasure Hunt

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

Start Hunting!