64-QAM Modulation and Demodulation
Show older comments
Here's example of Quadrature Amplitude Modulation with Bit Inputs:
M = 64;
bitsPerSym = log2(M);
x = randi([0 1],10*bitsPerSym,1); % x is input variable
% modulation
y = qammod(x,M,'bin','InputType','bit','OutputDataType', ...
numerictype(1,16,10));
% demodulation
z = qamdemod(y,M,'bin','OutputType','bit');
s = isequal(x,double(z))
The theory of 64 QAM is to transmit data with 8 bits per symbol.
My question, if the data I generate is not a multiple of 8 (like 61 bits), how can I do 64 QAM transmission?
Answers (1)
I understand that you are interested in how transmission is handled when the data length is not a multiple of the bits per symbol in qammod.
I have reviewed your issue, and here is how we can proceed to resolve it:
- When using 64-QAM, we transmit
bits per symbol. - If we generate data consisting of only 61 bits, we need to apply padding to ensure the data length is a multiple of 6. This is done by calculating the necessary padding as follows:
bitsPerSym = log2(M);
numBits = length(x);
paddingBits = bitsPerSym - mod(numBits, bitsPerSym);
- In this scenario, the required padding is calculated as
We add these 5 padding bits as zeros, proceed with the transmission as usual, and then remove the padding bits at the end.
Here is the MATLAB implementation of the scenario described above.
M = 64;
bitsPerSym = log2(M);
x = randi([0 1], 61, 1);
% Calculate padding required
numBits = length(x);
paddingBits =bitsPerSym - mod(numBits, bitsPerSym);
% Pad the data
x_padded = [x; zeros(paddingBits, 1)];
% Modulation & Demodulation
y = qammod(x_padded, M, 'bin', 'InputType', 'bit', 'OutputDataType', numerictype(1,16,10));
z_padded = qamdemod(y, M, 'bin', 'OutputType', 'bit');
% Remove padding
z = z_padded(1:numBits);
s = isequal(x, double(z))
Refer to the following MathWorks documentation for qammod and qamdemod respectively.
- https://www.mathworks.com/help/comm/ref/qammod.html
- https://www.mathworks.com/help/comm/ref/qamdemod.html
I hope this addresses your question.
Categories
Find more on PHY Components 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!