Random substitution for QAM symbols
6 views (last 30 days)
Show older comments
Hi everyone, I want to do a random substitution for QAM symbols based on secret key or random vector.
For example, suppose 4-QAM modulation with the following substitution:
(00) is substituated to (10) ,
(01) is substituated to (00),
(10) is substituated to (11), and
(11) is substituated to (01).
Based on a secret key, the subsituation box is changed.
May you guide me how to do that in matlab with any M-ary QAM?
Thanks in advance.
0 Comments
Answers (2)
Walter Roberson
on 11 Nov 2020
Edited: Walter Roberson
on 11 Nov 2020
lookup = [1 0; 0 0; 1 1; 0 1]; %must be in numeric order
output = reshape(lookup([2 1] * reshape(VectorOfBits, 2, []) + 1, :).', 1, []);
The [2 1]* is converting from 2 bit binary into decimal. Then +1 to get a 1-based index, that is used to index into the lookup table of replacements. The rest has to do with arranging bits in the right order for processing.
There are other ways, such as
output = reshape(lookup(VectorOfBits(1:2:end)*2 + VectorOfBits(2:2:end) + 1,:).', 1, []);
and some of the work can be made easier if you make the lookup table column-oriented instead of row oriented.
2 Comments
Walter Roberson
on 18 Nov 2020
I tested the code before I posted. Both versions work according to the requirements that were given.
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!