- qamdemod: https://www.mathworks.com/help/comm/ref/qamdemod.html
- de2bi: https://www.mathworks.com/help/comm/ref/de2bi.html
Calculate Bit Error Rate and Block Error Rate using MATLAB
9 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Shashi Kiran
on 17 Sep 2024
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 );
fprintf('Block Error Rate (BLER): %.2f\n', BLER );
Refer to the following documentations for more details about the functions:
Hope this helps.
0 Comments
See Also
Categories
Find more on QAM in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!