Mapping two binary bits to one
1 次查看(过去 30 天)
显示 更早的评论
I have generate a set of bits 0 and 1,
N=10000;
m=(sign(randn(1,N))+1)/2;
The problem is how do I group the bits? For example
00=-j
01=-1
10=1
11=j
1 个评论
采纳的回答
Walter Roberson
2019-12-2
vals = [-1j, -1, 1, 1j];
m2 = reshape(m, 2, []);
idx = m2(1,:) * 2 + m(2,:) + 1;
output = vals(idx);
4 个评论
Walter Roberson
2019-12-9
[, idx] = ismember(Symbols, [-1j, -1, 1, 1j]);
bits = [0 0; 0 1; 1 0; 1 1] .';
bit_vector = reshape(bits(:, idx), 1, []);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numbers and Precision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!