解调含噪 64-QAM 信号,并估计一定范围内 Eb/No 值的误码率 (BER)。将 BER 估计值与理论值进行比较。
设置仿真参数。
M = 64; % Modulation order
k = log2(M); % Bits per symbol
EbNoVec = (5:15); % Eb/No values (dB)
numSymPerFrame = 100; % Number of QAM symbols per frame
for n = 1:length(snrdB)
% Reset the error and bit counters
numErrs = 0;
numBits = 0;
while numErrs < 200 && numBits < 1e7
% Generate binary data and convert to symbols
dataIn = randi([0 1],numSymPerFrame*k,1);
dataSym = bit2int(dataIn,k);
% QAM modulate using 'Gray' symbol mapping
txSig = qammod(dataSym,M);
% Pass through AWGN channel
rxSig = awgn(txSig,snrdB(n),'measured');
% Demodulate the noisy signal
rxSym = qamdemod(rxSig,M);
% Convert received symbols to bits
dataOut = int2bit(rxSym,k);
% Calculate the number of bit errors
nErrors = biterr(dataIn,dataOut);
% Increment the error and bit counters
numErrs = numErrs + nErrors;
numBits = numBits + numSymPerFrame*k;
end% Estimate the BER
berEst(n) = numErrs/numBits;
end
使用 berawgn 函数确定理论 BER 曲线。
berTheory = berawgn(EbNoVec,'qam',M);
绘制估计 BER 数据和理论 BER 数据。估计 BER 数据点与理论曲线良好吻合。
semilogy(EbNoVec,berEst,'*')
hold on
semilogy(EbNoVec,berTheory)
grid
legend('Estimated BER','Theoretical BER')
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')