implementing a data communication system using error detection codes with small overhead and simple design.
조회 수: 12 (최근 30일)
이전 댓글 표시
Consider data communication system where sender (source) tries to send data protected with error detection codes to the destination (receiver) by using gray picture size (256x256). The requirements as below:
-small overhead (i.e. the added number of redundancy bits should be smaller than the number of bits for data word)
-low complexity or simple design
Show the output results in term of snapshot of sample signals, calculation bit error rate (obtain by comparing output bits against input bits)
댓글 수: 0
답변 (1개)
Ayush Modi
2024년 1월 13일
Hi,
I understand you would like to create a simple system where sender sends the data to the receiver, protecting it with error detection codes. Here is an example to demonstrate how you can achieve this:
SENDER:
% Convert the image to a binary stream
% Calculate parity bits for each 8-bit word
numWords = length(imageBinary) / 8;
parityBits = zeros(numWords, 1);
for i = 1:numWords
dataWord = imageBinary((i-1)*8 + (1:8));
parityBits(i) = mod(sum(dataWord), 2); % Even parity bit
end
% Append parity bits to the data stream (for simplicity, we append at the end)
transmittedData = [imageBinary; parityBits];
receivedData = transmittedData;
errorIndices = randperm(length(imageBinary), 10); % Introduce 10 random errors in the data part
receivedData(errorIndices) = ~receivedData(errorIndices);
RECEIVER:
% Separate the data and parity bits from receivedData for error checking
receivedDataBits = receivedData(1:length(imageBinary));
receivedParityBits = receivedData(length(imageBinary) + 1:end);
% Check for errors using parity bits
receivedParityBits = receivedData(end-numWords+1:end);
receivedData = receivedData(1:end-numWords);
numErrorsDetected = 0;
for i = 1:numWords
dataWord = receivedData((i-1)*8 + (1:8));
if mod(sum(dataWord), 2) ~= receivedParityBits(i)
numErrorsDetected = numErrorsDetected + 1;
end
end
numBitErrors = sum(imageBinary ~= receivedDataBits);
totalBits = length(imageBinary);
BER = numBitErrors / totalBits;
I hope this helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 Communications Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!