random bit to a block of some fix length?

5 ビュー (過去 30 日間)
Chetan Fadnis
Chetan Fadnis 2022 年 4 月 22 日
編集済み: Bruno Luong 2022 年 4 月 22 日
Sir,
Suppose, I have a binary data sequence and want to modulate it using say M-QAM, M=16 (k=log2(M)=4bits)
x=[011000101010010101000100010000011111110001010....];
s=qammod(x,16);
this generates the modulated data corresponding to only single bit at a time, but
I want to generate it for following, i.e. it should first concatenate four bits together and then modulate
x=[0110,0010,1010,0101,0100,0100,0100,0001,1111,1100,0101,0....]
How to acomplish this?
Thanks in anticipation.

採用された回答

Bruno Luong
Bruno Luong 2022 年 4 月 22 日
編集済み: Bruno Luong 2022 年 4 月 22 日
x='01100010101001010100010001000001111111000101111'
x = '01100010101001010100010001000001111111000101111'
bl = 4;
xb=x-'0'; % convert to binary array
xb(end+(1:mod(-end,bl)))=0; % pad 0 so length xb is multiple of 4
xb=reshape(xb,bl,[])'; % each row is 4-bit chunk
disp(xb)
0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 0 1 1 1 1 0

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by