1

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

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 
4

3 回答 3

1

像这样的东西应该有效;

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
于 2018-07-23T19:56:47.620 回答
0

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

resymbols = real(r);
imsymbols = imag(r);
symbols1 = resymbols + 1i*imsymbols;
于 2018-07-21T19:58:30.923 回答
0

请记住,将以下星座用于 QPSK {1, -1, 1j, -1j} 是相当少见的

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

于 2021-10-23T10:26:32.283 回答