hichamjanati / pyldpc

Creation of LDPC codes & simulation of coding and decoding binary data. Applications to sound and image files.
BSD 3-Clause "New" or "Revised" License
119 stars 32 forks source link

How to use modulations other than BPSK(eg. QPSK)? #26

Open MacroMicroMichael opened 1 year ago

MacroMicroMichael commented 1 year ago

Thanks for your work. It seems that the encoder uses BPSK modulation in default. Where should I change the code to use QPSK modulation?

JrunDing commented 1 year ago

I have the same question. How did you solve this?

MacroMicroMichael commented 1 year ago

I have the same question. How did you solve this?

I change its source code by removing the BPSK and then add QPSK manually.

JrunDing commented 1 year ago

I can change modulation in encoder.py, but how to change modulation in decoder.py?

MacroMicroMichael commented 1 year ago

Here's my version of the modification and hope that helps. In decoder.py, I map QPSK's complex sequence back to the real sequence and then calculate the LLR. Here's the code: (the mapping rule may be different)

    tmp = np.empty((2*y.shape[0], y.shape[1]))
    for j in range(tmp.shape[1]):
        for i in range(tmp.shape[0]):
            tmp[i,j] = y[i//2,j].real if i%2==0 else y[i//2,j].imag
    Lc = 2 * tmp / var # MSE

    Lc = Lc.astype('float64')

Then Lc is sent into BP algorithm for demodulation the same as before.

JrunDing commented 1 year ago

Thanks for the reply but I still have a question. Why do you map the complex sequence of QPSK back to the real sequence (floating point, floating point, floating point) in this way instead of QPSK demodulation (0, 1, 0, 1)? I dont know how to use 64QAM.

JrunDing commented 1 year ago

Thanks!! I have solved this problem!

Zhu0518 commented 9 months ago

Thanks!! I have solved this problem!

How did you solve your questions about 64QAM?