Calculate Bit Error Rate and Block Error Rate using MATLAB

17 次查看(过去 30 天)
I require a way to calculate Block Error and Bit Error Rate of QAM Signals. How should I take the approach.
eg: I have a TxData = [0.707+0.707*j,0.707-0.707*j, -0.707-0.707*j, -0.707+0.707*j] and RxData = [0.707-0.707*j,0.707-0.707*j, +0.707-0.707*j, -0.707-0.707*j]
I require Matlab code to calculate the Block and Bit error rate of these Tx and Rx Data.

回答(1 个)

Shashi Kiran
Shashi Kiran 2024-9-17
Hi Sukshith,
I see you are interested in calculating the Bit Error Rate (BER) and Block Error Rate (BLER) using MATLAB for your given transmit and receive data.
Here is how you can achieve that:
% Parameters
M = 4;
k = log2(M);
% TxData and RxData
TxData = [0.707+0.707j, 0.707-0.707j, -0.707-0.707j, -0.707+0.707j];
RxData = [0.707-0.707j, 0.707-0.707j, 0.707-0.707j, -0.707-0.707j];
% Demodulate transmitted symbols to bits
TxSymbols = qamdemod(TxData, M);
TxBits = de2bi(TxSymbols, k, 'left-msb');
TxBits = TxBits(:); % Reshape to a column vector
% Demodulate received symbols to bits
RxSymbols = qamdemod(RxData, M);
RxBits = de2bi(RxSymbols, k, 'left-msb');
RxBits = RxBits(:); % Reshape to a column vector
% Calculate Bit Error Rate (BER)
numBitErrors = sum(TxBits ~= RxBits);
totalBits = numel(TxBits);
BER = numBitErrors / totalBits;
% Calculate Block Error Rate (BLER)
numBlockErrors = sum(TxSymbols ~= RxSymbols);
totalBlocks = numel(TxSymbols);
BLER = numBlockErrors / totalBlocks;
% Display results
fprintf('Bit Error Rate (BER): %.2f\n', BER );
Bit Error Rate (BER): 0.38
fprintf('Block Error Rate (BLER): %.2f\n', BLER );
Block Error Rate (BLER): 0.75
Refer to the following documentations for more details about the functions:
  1. qamdemod: https://www.mathworks.com/help/comm/ref/qamdemod.html
  2. de2bi: https://www.mathworks.com/help/comm/ref/de2bi.html
Hope this helps.

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by