Convert binary integers to quaternary integers

Is it possible to convert binary integers generated using a randi() to quaternary integers (0-3) by taking two bits from the source and combining them?

 採用された回答

M
M 2012 年 5 月 17 日

0 投票

Solved it myself. It can be done easily by converting back to decimal from Galois Field, reshaping into n x 2 matrix and adding the columns.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 5 月 17 日

0 投票

Yes. B1*2 + B2

2 件のコメント

M
M 2012 年 5 月 17 日
Thanks. I forgot to mention that I am converting the binary integers to Galois Field with m=1 for BCH coding. Now I want to convert the numbers to quaternary format for QPSK modulation.
Walter Roberson
Walter Roberson 2012 年 5 月 17 日
If you need to, put the 4 possible results into a vector, and index the vector at B1*2 + B2 + 1

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

カテゴリ

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

質問済み:

M
M
2012 年 5 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by