Random substitution for QAM symbols
Afficher commentaires plus anciens
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.
Réponses (2)
Walter Roberson
le 11 Nov 2020
Modifié(e) : Walter Roberson
le 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 commentaires
YAHYA AL-MOLIKI
le 18 Nov 2020
Modifié(e) : YAHYA AL-MOLIKI
le 18 Nov 2020
Walter Roberson
le 18 Nov 2020
I tested the code before I posted. Both versions work according to the requirements that were given.
YAHYA AL-MOLIKI
le 18 Nov 2020
Modifié(e) : YAHYA AL-MOLIKI
le 18 Nov 2020
0 votes
1 commentaire
YAHYA AL-MOLIKI
le 18 Nov 2020
Catégories
En savoir plus sur QAM dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!