-1

我正在使用卷积码和 QAM-16 调制方案来模拟 CDMA 中 2 个用户之间的 BER。从我附上的图表来看,用户 1 和用户 2 的 BER 相同且恒定。SNR 似乎不影响传输。无论如何我可以改进图表吗?这是我的代码:

M = 16;                 % Modulation order
k = log2(M);            % Bits per symbol
EbNoVec = (0:20)';      % Eb/No values (dB)
numSymPerFrame = 1;   % Number of QAM symbols per frame
users=2;            % Number of Users
trellis = poly2trellis(7,[171 133]);
tbl = 32;
rate = 1/2;
%------------------Generation of Walsh code--------------------------------
noOfSubCarrier =20;                               %Number of  Data Sub-Carriers
walsh=hadamard(noOfSubCarrier);
code1=walsh(10,:);                   
code2=walsh(20,:); 

berEst1 = zeros(size(EbNoVec));
berEst2 = zeros(size(EbNoVec));%Initialize the results vector

% The main processing loop executes the following steps:
% Generate binary data and convert to 64-ary symbols
% QAM modulate the data symbols
% Pass the modulated signal through an AWGN channel
% Demodulate the received signal
% Convert the demoduated symbols into binary data
% Calculate the number of bit errors

for n = 1:length(EbNoVec)
    % Convert Eb/No to SNR
    snrdB = EbNoVec(n) + 10*log10(k*rate);
    % Reset the error and bit counters
    numErrs1 = 0;
    numErrs2 = 0;
    numBits = 0;

    % Generate binary data and convert to symbols
    B=10;
    dataIn1= rand(1,B);
    dataIn2=rand(1,B);
    symbols1= unique(dataIn1);
    symbols2= unique(dataIn2);
    probs1 = histc(dataIn1,symbols1)./numel(dataIn1);
    probs2 = histc(dataIn2,symbols2)./numel(dataIn2);
    [dict1, avglen1] = huffmandict(symbols1, probs1);
    [dict2, avglen2] = huffmandict(symbols2, probs2);
    comp1 = huffmanenco(dataIn1,dict1);
    comp2 = huffmanenco(dataIn2,dict2);
     % Convolutionally encode the data
    dataEnc1 = convenc(comp1,trellis);
    dataEnc2 = convenc(comp2,trellis);

    % QAM modulate
    txSig1 = qammod(dataEnc1,M,0);
    txSig2 = qammod(dataEnc2,M,0);
    %------------------Spreading & IFFT for User1------------------------------
    Tx_data1=txSig1';
    Spread_User1=Tx_data1*code1;    % Spreading 
    Spread1=(Spread_User1)';
    ifftdata_user1=ifft(Spread1);      % Taking the IFFT
    ifftdata1=ifftdata_user1';
    %------------------Spreading & IFFT for User2------------------------------
    Tx_data2=txSig2';
    Spread_User2=Tx_data2*code2;    % Spreading 
    Spread2=(Spread_User2)';
    ifftdata_user2=ifft(Spread2);      % Taking the IFFT
    ifftdata2=ifftdata_user2';
    %----------------------Addition of all signal------------------------------
    TotSignal = Spread1+Spread2;
    % Pass through AWGN channel
    AwTotSignal = awgn(TotSignal,snrdB,'measured');
    %-----------------------Removing the FFT & De-Spreading--------------------
    fft_data_received =fft(AwTotSignal);
    Rec_Data1=(AwTotSignal'*code1');
    Rec_Data2=(AwTotSignal'*code2');
    % Demodulate the noisy signal
    rxSym1 = qamdemod(Rec_Data1,M,0);
    rxSym2 = qamdemod(Rec_Data2,M,0);
    data1=vitdec(rxSym1,trellis,5,'cont','unquant');
    data2=vitdec(rxSym2,trellis,5,'cont','unquant');
    % Convert received symbols to bits
    %dataOut1 = de2bi(data1,k);
    %dataOut2 = de2bi(data2,k);
    % Calculate the number of bit errors
    nErrors1 = biterr(comp1',data1);
    nErrors2 = biterr(comp2',data2);
    % Increment the error and bit counters
    numErrs1 = numErrs1 + nErrors1;
    numErrs2 = numErrs2 + nErrors2;
    numBits= numBits + numSymPerFrame*k;

    % Estimate the BER
    berEst1(n) = numErrs1/numBits;
    berEst2(n) = numErrs2/numBits;
end

误码率图

4

1 回答 1

1

[注意:这实际上应该是一个评论,但我不能用我目前的 SO 声誉来写它们,这是 OP 应该知道的]

首先,我承认我没有特别仔细地查看您的代码,因为我在图表中看到的错误来自与 CDMA 或手头的调制无关的错误。

我想说最显着的错误不是图形保持不变,而是 BER 超过 1。这根本没有意义,至少表明您对 BER 本身的表述有问题。

此外,如果 BER 实际上是 1 而不是超过它,那仍然没有意义。考虑到 BER 为 1(更不用说 OVER 1)意味着您每次都无法正确恢复符号。通过简单的统计,即使随机挑选它们,您也应该至少正确地恢复其中一些。这是此类应用程序中的另一个常见错误场景。

也就是说,检查您的 BER 公式并绘制一些中间值。不要一步完成所有事情(例如:尝试没有更正代码的系统)。

我希望这能让你朝着正确的方向前进。

于 2016-03-22T10:44:06.540 回答