1
$\begingroup$

Below is an example of a digital modulation system using 16-QAM. I have copied this example from MATLAB communications toolbox,

   M = 16;                     % Size of signal constellation
   k = log2(M);                % Number of bits per symbol
   n = 30000;                  % Number of bits to process
   numSamplesPerSymbol = 1;    % Oversampling factor
   dataIn = randi([0 1],n,1);
   dataInMatrix = reshape(dataIn, length(dataIn)/4, 4); % Reshape data into binary 4-tuples
   dataSymbolsIn = bi2de(dataInMatrix);
   dataMod = qammod(dataSymbolsIn, M);

I am wondering if

1) there is a need to reshape the bits into tuples of 4 bits

2) there is a need to do the mapping from binary to decimal and then do the QAM modulation, couldn't I just have done

dataMod = qammod(dataIn, M);

Thanks.

$\endgroup$

1 Answer 1

1
$\begingroup$

First of all, I recommend getting familiar with Matlab's doc command. doc qammod has the answers to your second question: qammod requires a vector of integers between 0 and M-1.

Regarding your first question: the reason to reshape your bits into groups of four is that 16-QAM transmits $\log_2(16)=4$ bits per symbol. So, your bi2de command requires binary numbers of four bits to get decimal integers betwen 0 and 15.

If you want to save lines of code, what you could do is generate integers between 0 and 15 directly, with dataSymbolsIn = randi([0 15], n/4, 1). However, doing this has one disadvantage: calculating the bit error rate at the receiver is more complicated if all you have are the integers. Let's say that you transmit a 15 and receive a 13 (obtained with qamdemod), how many bit errors there were? This is why it's common practice to start with actual bits in the transmitter and compare them one-to-one with the received bits.

$\endgroup$
10
  • $\begingroup$ thank you, I understand the reasoning, however I thought in a real digital communication system, we don't have such a mapping from binary to decimal, am I right? i.e we directly go from bits (0 and 1) to symbols? $\endgroup$
    – Tyrone
    Commented Apr 14, 2015 at 22:46
  • $\begingroup$ by the way I noticed that you answer alot of digital communications questions, I am relatively new in this site. Was wondering is it OK to tag you in my questions or comments so you can help me further? $\endgroup$
    – Tyrone
    Commented Apr 14, 2015 at 22:59
  • $\begingroup$ @Tyrone You are correct that one always maps bits to symbols. The requirement of having a vector of integers as argument is particular to qammod. Personally, in my simulations I prefer to map groups of bits to the actual analog amplitude that the transmitted signal will have, because this makes it easier to calculate the noise power that results in a specific SNR. $\endgroup$
    – MBaz
    Commented Apr 14, 2015 at 22:59
  • $\begingroup$ @Tyrone, if you tag your questions as 'digital-communications', I'll see them, and I'll be happy to answer them if I have the time and know the answer :) Other site regulars know a lot about this subject, too. $\endgroup$
    – MBaz
    Commented Apr 14, 2015 at 23:01
  • $\begingroup$ I see, I have I noticed in MATLAB that they send the QAM symbols as is through the AWGN channel, for example following the notation of the code I presented above, they add, receivedSignal = awgn(dataMod, snr, 'measured'); Isn't this wrong I mean why arent we converting the symbols to an analog signal and then transmitting it over the AWGN channel? $\endgroup$
    – Tyrone
    Commented Apr 14, 2015 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.