0
$\begingroup$

Any help to get me started is appreciated. I have an array of values for the 4-QAM where attach is a copy of part of the values of the array. I want to know how do I get the bits 0 and 1s from those values. I would be using python to program. Thank you very much enter image description here

I have searched the forum and the post below is something that I am trying to do..I understand on how to get the bits. Is there a formula where I can feed the above values? Most references state to check the BER (bit error rate) but do we get the bits..

Recover IQ samples from signal

"If you just want to demodulate, then it is not necessary to recover I and Q components. What you have is most likely the QAM symbols. For example, for 16-QAM they are 16 different integer values that are assigned to different constellation points. You need to know the type of assignment (i.e. coding) that is used in the QAM constellation at the modulator."

$\endgroup$
3
  • $\begingroup$ If this is the signal waveform it is not representative of 4-QAM in any recognizable way. You would need two signals such as I and Q or magnitude and phase since 4-QAM is a complex signal. Or if this is the carrier signal, then you have far too short of the sequence to be recognizable. Can you post a plot of the sequence for 200 or more samples to see if that is the case? $\endgroup$ Apr 21, 2020 at 15:53
  • $\begingroup$ Thanks for the reply. I only plotted the first few samples but each symbol has around 5000 samples. I will post the first 200 samples $\endgroup$
    – Zizi
    Apr 21, 2020 at 16:03
  • $\begingroup$ Oh that clears up a lot! Actually we won't see anything from the first 200 then, but I can add further details as an answer $\endgroup$ Apr 21, 2020 at 16:04

3 Answers 3

0
$\begingroup$

From your comment it appears this is cycles of the real waveform at some intermediate frequency. You mentioned 5000 samples/symbol. To demodulate this you would want to do some sort of "carrier recovery" to create a fixed tone centered at this intermediate frequency and then multiply by that carrier to demodulate. For QPSK you would create a Sine and Cosine carrier multiply and low pass filter to extract I and Q such as the block diagram at this post

Implementing QPSK Demodulation

A simple approach to carrier recovery for QPSK is to multiply your signal to the 4th power which will create a strong spectral component at 4x your carrier frequency; you can then filter out that tone, and divide the frequency by 4 (by counting every 4th cycle) and from that create your synchronized sine and cosine carrier for demodulation.

In an all digital receiver I would do carrier recovery differently such as using a Costas Loop as in this diagram from Wikipedia (https://en.wikipedia.org/wiki/Costas_loop), but the $(x)^4$ approach is the most straight-forward to get working quickly.

QPSK Costas Loop

$\endgroup$
5
  • $\begingroup$ Yes, I believe you need to demodulate your signal first. Create a sine and cosine matched to the sinusoid you show in your plot, multiply your signal by that and low pass filter to get I and Q out. $\endgroup$ Apr 21, 2020 at 16:19
  • $\begingroup$ This is programming of signal processing. Multiply in your program, and filter in your program. If you are using Python are you familiar with the Numpy and Scipy libraries? $\endgroup$ Apr 21, 2020 at 16:23
  • $\begingroup$ No it doesn't change anything. Since you said you have 5000 samples per symbol you are presenting the real IF waveform. (The modulated waveform). My suggestion is a way to demodulate that, try it! After you multiply you will get a low frequency representing your data symbols and high frequency at twice the carrier- you filter out the high frequency as shown in these block diagrams. If the carrier is not synchronized, the I and Q output will rotate at the offset between the real carrier and your estimate of it for the sine and cosine. Good luck! $\endgroup$ Apr 21, 2020 at 16:29
  • $\begingroup$ I would like to try the most simplest approach for starters which is "A simple approach to carrier recovery for QPSK is to multiply your signal to the 4th power which will create a strong spectral component at 4x your carrier frequency; you can then filter out that tone, and divide the frequency by 4 (by counting every 4th cycle) and from that create your synchronized sine and cosine carrier for demodulation.". What do you mean by 4th power? $\endgroup$
    – Zizi
    Apr 21, 2020 at 16:35
  • $\begingroup$ Let us continue this discussion in chat. $\endgroup$ Apr 21, 2020 at 16:36
0
$\begingroup$

It is not completely clear what is the question but based on the last quoted paragraph, if you need to know how the 4-QAM mapping was done at transmitter. For example, if the mapping is

bits {00} -> 0

bits {01} -> 1

bits {10} -> 2

bits {11} -> 3

then if you receive an integer stream $\{2,3,0,1,2,1\}$, then the bits are $\{10,11,00,01,10,01\}$. Does that answer? If not, what exactly is your input array?

$\endgroup$
3
  • $\begingroup$ So you have sinusoid signal? $\endgroup$
    – jithin
    Apr 21, 2020 at 16:11
  • $\begingroup$ yes, I believe so.. $\endgroup$
    – Zizi
    Apr 21, 2020 at 17:05
  • $\begingroup$ This answer is so wrong.... Whatever happened to Gray coding? $\endgroup$ Dec 29, 2021 at 4:26
0
$\begingroup$

I can also not really understand what your question is exactly. In terms of I and Q component, you can simply think of a complex receive symbol, where the real part corresponds to the I and the imaginary part corresponds to the Q value. However, if you want to demodulate a signal (e.g. 4QAM) you have to use a defined mapping from the modulator to demodulate correctly at the receiver side. A python coding example for an AWGN Channel with 4QAM could look like:

def modulate_4QAM(bits):
    b_temp = np.reshape(bits * 2 - 1, (-1, 2)) # reshape bits in [0,1] to [-1,1]
    x = 1 / np.sqrt(2) * (b_temp[:, 0] + 1j * b_temp[:, 1])
    return x

def detecting_4QAM(received_signal):
    # detecting (slicing) and de-mapping
    received_bits = np.zeros((len(received_signal), 2))
    received_bits[:, 0] = np.real(received_signal) > 0
    received_bits[:, 1] = np.imag(received_signal) > 0
    received_bits = np.reshape(received_bits, (-1,))
    return received_bits

number_of_bits = 4; #number of bits to send one QAM symbol

#Generate data
b = pyl.randint(0, 2, int(number_of_bits)) # generate random bits
x = modulate_4QAM(b) # map bits to complex symbols
y_AWGN =x+noise # add the noise to the signal

# detecting (slicing) and de-mapping
b_received = detecting_4QAM(y_AWGN)

Note that this is only a fraction of a code from a BER simulation with an AWGN channel and a 4 QAM modulation from: https://github.com/TheWirelessClassroom/PythonExamples/tree/Modulation

$\endgroup$

Your Answer

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

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