# Matlab: Channel coding and modulation [closed]

This is a beginner level question on understanding modulation and channel coding. The confusion arises when I am trying to implement the concepts. Let's say I have the information bits as x = rand(1,N);

Then,

information_bits = x>=0;


Q1. Why cannot we use the information as numerical data? Why do we need symbols 0/1 or M-symbols in communication?

Q2. Modulation - I have seen in many places where BPSK modulation is invoked by this statement: transmitted_data = 2*(x>=0)-1;

This generates +1/-1 symbols. Where is the coding at the transmitter? If we are not doing any coding, then how come a hard decision decoder is applied in this example link where in the paragraph for Simulation model and in the code is written : perform hard-decision decoding. Without channel coding, why should we do this step?Or maybe I cannot understand the way coding has been done.

Q4. How can we demodulate the data at the receiver for example for BPSK? Is hard decision a way of demodulating?

Q5. What is the correct way of doing QAM modulation, coding and then decoding and demodulation

## closed as too broad by Andy aka, Daniel Grillo, Fizz, The Photon, Scott SeidmanNov 19 '15 at 4:28

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Demodulation of data in a real data receiver (given that there is no coherent carrier to be easily extracted) requires a big answer and I feel this, plus the other questions (especially the requirement for anyone answering to understand MATLAB) makes these series of question not a good fit for EE Q&A. I'm voting to close but if you can refine your question somewhat it may live to see another day. – Andy aka Oct 25 '15 at 19:58
• I had asked this Question in dsp and they told me ask here. The Question is based on the example in Matlab because it is difficult for me to match the concept when implementing. When I see that code, I am not able to find the steps. Any other way of explaining will do. – Ria George Oct 25 '15 at 20:15
• Trouble is it's not a question that fully translates into my EE lingo so I'm stumped in understanding it mainly. You might, on the other hand get an EE who knows matlab but who has little knowledge about radio transmission so the question, as a whole becomes difficult to answer but good luck. – Andy aka Oct 25 '15 at 20:21
• I think me and Andy have roughly the same idea: has this question anything to do with Matlab? I don't think so, why did you include the code then? I'll try to answer anyway doing my best, maybe the (I'm afraid incomplete) answer can help you build a better question. – Vladimir Cravero Oct 25 '15 at 20:21
• @VladimirCravero go for it and I'll wait to see what I can add. – Andy aka Oct 25 '15 at 20:29

A1

That's because usually, i.e. in simpler transmitters, information is transmitted serially, i.e. one bit at a time. The simplest transmitter that comes to mind is an on/off transmitter: when you transmit the carrier this means one, when you don't transmit anything that's a zero. Even in slightly more complicated schemes, like QAM, you transmit 2 bits of data per symbol. Since your data is probably wider than 2 bits you need to split it in 'packages' accordingly to your modulation scheme.

A2

In BPSK, i.e. bynary phase shift keying, the scheme is very simple: a one has phase zero, while a zero has phase $\pi$. Luckily enough this translates to a simple multiplication by 1 or -1. That's the coding, simple as that.

A3

Apparently you forgot that 3 comes after 4.

A4

Demodulating and decoding are two different things. In BPSK you first encode your data in $\pm1$, then you use it to modulate the carrier. Modulation in this case is achieved multiplying the carrier by the data, hence we are speaking of AM modulation. Since data is $\pm1$ we can also see this as phase modulation, i.e. carrier phase is shifted either by zero or $\pi$. When you receive the signal you need to demodulate it, bringing it back to baseband, multiplying it by the carrier, then you have to decode it, linking a +1 to a 1 and -1 to a 0. To do this you need a decoder that decides if the demodulated data corresponds to a 1 or a 0. I am not sure what you mean by hard decision, but again, demodulation and decoding are two different things.

A5

Again, it seems to me that you are a bit confused about modulation and encoding. QAM is a modulation scheme that uses both the in phase and quadrature components of the carrier to carry data, so it allows to transmit twice the symbols. In a QAM modulator you can use two different encodings for the two transmitter sections, e.g. BPSK for the in phase branch and RTZ for the quadrature branch. When you receive the signal you first need to demodulate it with an appropriate demodulator that can retrieve both the in phase and quadrature signals, then each signal must be decoded appropriately, depending on the encoding scheme chosen for the transmitter.

• Great! You have answered almost everything in simple terms. I really wanted an English like explanation for telling the actual mechanism without using complicated jargons. Thank you. I have 2 Questions based on you response. (1) Is there any rule for deciding on the number of levels, M for modulation technique, viz. MPSK, M-QAM. Using the Bit error rate performance criteria, we can check which one yields a lower bit error rate. Apart from that, is there any other reason? – Ria George Oct 25 '15 at 20:51
• (2) When I mentioned about hard decision, I meant demodulating a BPSK signal using that, for ex: the operation: real(received signal) > 0 – Ria George Oct 25 '15 at 20:52
• The number of levels is decided depending on the noise on the channel and the desired robustness of the communication. You could write a book about that, just wait some time and you will se that it will become clearer. – Vladimir Cravero Oct 25 '15 at 20:53
• Well done dude +1 and Ria please note that recovery of a coherent carrier is not a simple task! – Andy aka Oct 25 '15 at 21:00