在 MATLAB 中计算 QPSK(对于 AWGN 信道)的错误率

Calculating Error Rates for QPSK(for AWGN channel) in MATLAB

我想模拟 AWGN 通道的 QPSK,并将我得到的误差与绘图上的理论误差进行比较。我想在 MATLAB 上针对从 1 到 10 的不同 SNR 值执行此操作。当我绘制它时,我发现模拟误差和理论误差之间存在巨大差异。我怀疑我可能已经完成了解调部分。我在那里使用了 atan 函数,但我不能 %100 确定它是否有效。你能帮帮我吗?

M=100000;
snrdB=1:10;
snr=10.^(snrdB/10);
sError = zeros(1,10);%simulated error
tError = zeros(1,10);%theoritical error
for i=1:10
    symbols = randi([1,4],1,M);
    symbols(symbols == 1) = 1;
    symbols(symbols == 2) = 1i;
    symbols(symbols == 3) = -1;
    symbols(symbols == 4) = -1i;

    %calculating total energy
    Eb = 0;
    for k=1:M
        Eb = Eb + abs(symbols(k).^2);
    end
    Eb = Eb/2;

    var = abs(sqrt(Eb/(2*snr(i))));%variance
    noise = var*rand(1,M) + var*1i*rand(1,M);%noise

    r=symbols+noise;%adding noise

    symbols1 = atan(r);%demodulation

    error = abs((symbols - symbols1)./abs(symbols));%error
    sError(i) = mean(error);
    tError(i) = 2*qfunc(sqrt(2*snr(i)));%theoritical error
end
%comparison
semilogy(snrdB, tError,'x-')  
hold on
semilogy(snrdB, sError,'o-')                                 
xlabel('snr(dB)')                                    
ylabel('error')                                         
grid on 

我也觉得解调有问题。你不应该在这里使用 atan。我建议您应该分别处理实部和虚部。删除带有 atan 的行并替换为这些行:

resymbols = real(r);
imsymbols = imag(r);
symbols1 = resymbols + 1i*imsymbols;

像这样的东西应该有用;

M=100000;
snrdB=1:10;
snr=10.^(snrdB/10);
sError = zeros(1,10);%simulated error
tError = zeros(1,10);%theoritical error


for i=1:10
    symbols = randi([1,4],1,M);

    symbols(symbols == 1) = 1;
    symbols(symbols == 2) = 1i;
    symbols(symbols == 3) = -1;
    symbols(symbols == 4) = -1i;

    var = 1/(2*sqrt(snr(i)));%variance

    noise = var*(randn(1,M)) + var*j*(randn(1,M));

    r=symbols+noise;%adding noise

    c1 = exp(j*pi/4);
    c2 = exp(-j*pi/4);

    symbols1 = sign(real(symbols .* c1));
    symbols2 = sign(imag(symbols .* c1));

    symbols3 = sign(real(symbols .* c2));
    symbols4 = sign(imag(symbols .* c2));

    symbols1r = sign(real(r .* c1));
    symbols2r = sign(imag(r .* c1));

    symbols3r = sign(real(r .* c2));
    symbols4r = sign(imag(r .* c2));


    ind = find(symbols1==symbols1r & symbols2==symbols2r & symbols3==symbols3r & symbols4==symbols4r);

    sError(i) = (M-length(ind))/M;
    tError(i) = 2*qfunc(sqrt(2*snr(i)));%theoritical error
end
%comparison

semilogy(snrdB, tError,'x-')  
hold on
semilogy(snrdB, sError,'o-')                                 
xlabel('snr(dB)')                                    
ylabel('error')                                         
grid on

请记住,使用以下内容并不常见 QPSK星座 {1, -1, 1j, -1j}

通常你使用: {1+1j, 1-1j, -1+1j, -1-1j}