- 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 次查看(过去 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.
0 个评论
回答(1 个)
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 );
fprintf('Block Error Rate (BLER): %.2f\n', BLER );
Refer to the following documentations for more details about the functions:
Hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 QAM 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!