Another sub question. The result of the decoder returns the binary vector sans the parity bits. I want the enitre corrected code with parity bits too, atleast.
BCH Encoder - Error Locations
3 views (last 30 days)
Show older comments
Hello All,
I am using the 'Communications Toolbox' and there is this 'comm.BCHDecoder' that I intend to use.
A deeper study about that function by Matlab reveals that it is apparently perfect for use.
So it uses this 'Berklamp Massey' algorithm to decode and find the error locations in the transmitted binary vector.
I was wondering on how to extract those error locations (indices).
The available functions kinda works out everything internally and giver out the error free binary vector, which is great, but I also want the locations of the errors.
Please let me know. Thanks
2 Comments
Walter Roberson
on 7 Apr 2022
Unfortunately that is a .p file so we cannot see the code.
The features you request do not appear to be available.
Answers (1)
Pooja Kumari
on 13 Jan 2024
Hello rishi,
As per my understanding, you wanted to know error locations in the transmitter binary vector but comms.BCHDecoder does not have this option. BCH decoder is a .p file and you cannot edit the code or see the code. If you wanted to extract exact location in the transmitted Binary vector, you can write custom code for BCHDecoder in which you can edit the code. You can refer to below code for possible inverse workaround in which you already know the error location and you can check error locations by comparing the original encoded message and the received message.
An example code for the same given below:
% Define BCH code parameters
n = 15; % Codeword length
k = 5; % Message length
% Create BCH encoder and decoder objects
bchEncoder = comm.BCHEncoder('CodewordLength', n, 'MessageLength', k);
bchDecoder = comm.BCHDecoder('CodewordLength', n, 'MessageLength', k);
msg = randi([0 1], k, 1); % Generate a random message
encodedMsg = step(bchEncoder, msg); %Encoded message
receivedMsg = encodedMsg;
errorPositions = [3, 7]; % Example error positions
receivedMsg(errorPositions) = ~receivedMsg(errorPositions); % Flip bits to introduce errors
[decodedMsg, errorStats] = step(bchDecoder, receivedMsg); % Decoded message
% Find error locations by comparing the original encoded message and the received message
errorLocations = find(encodedMsg ~= receivedMsg);
BCH decoder typically outputs the corrected message bits, excluding the parity bits. This is because the main purpose of the decoder is to retrieve the original message, and the parity bits are used during the error correction process.
Hope this helps!
0 Comments
See Also
Categories
Find more on Error Detection and Correction in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!