1

我想编写一个模拟 16-QAM 调制和解调的程序。首先,该程序创建一个由 1000000 个随机生成的位组成的数组,将它们分组为 4 位值并转换为数值。然后它进入 16-QAM 调制,为 SNR 0 到 20dB 添加 AWGN 噪声。然后对其进行解调并将每个结果转换为二进制。当我比较理论和实验结果的 BER 时,我发现我的结果比理论值差得多。该程序在 4-QAM 上运行良好,但在 16-QAM 上却得到了不太好的结果。你能帮忙吗?

clear all
clc

a = randi([0 1], 1, 1000000);%random binary array
b = zeros(1,250000);
for i=1:250000%4-bits grouped into one
    b(i) = 8*a(4*i-3) + 4*a(4*i-2) + 2*a(4*i-1) + a(4*i);
end
c = qammod(b,16,'UnitAveragePower',true);%16-QAM modulation

k = 0:20;%SNR

d = zeros(length(k),250000);
for i=1:length(k)
    d(i,1:250000) = awgn(c,k(i),'measured');%noise is added for different SNR values
end
e = qamdemod(d,16);%demodulation of 16-QAM
f = zeros(length(k),1000000);
for j=1:length(k)%results of numerical values are converted to 4-bit binary
    for i=1:250000
        temp = e(j,i);
        f(j,4*i-3) = floor(temp/8);
        temp = temp - 8;
        f(j,4*i-2) = floor(temp/4);
        temp = temp - 4;
        f(j,4*i-1) = floor(temp/2);
        temp = temp - 2;
        f(j,4*i) = rem(e(j,i),2);
    end
end

r = zeros(1,length(k));%BER is calculated
for i=1:length(k)
    for j=1:1000000
        if(a(1,j) ~= f(i,j))
            r(i) = r(i) + 1/1000000;
        end
    end
end

t = zeros(1,length(k));%Theoritical result for BER is calculated
M = 16;
for i=1:length(k)
    t(1,i) = 1-(1-2*sqrt(M-1)/sqrt(M)*qfunc(sqrt(3*k(1,i)/(M-1)))).^2;
end

plot(k,t)%results are plotted
hold on
plot(k,r)   
4

1 回答 1

0

如果您在使用 qammod 和 qamdemod 函数时遇到问题,您可以模拟 QAM,而无需使用它们。在互联网上查找 16-QAM 映射,您可以给它们必要的值并使用决策边界对其进行解调。

于 2020-06-09T20:21:16.213 回答