0% found this document useful (0 votes)
16 views5 pages

Exp - 11

The document discusses simulating linear block and cyclic error control coding schemes using MATLAB. It provides theory on linear block codes and cyclic codes. It then shows code to generate linear block code words and calculate the minimum weight. It also shows code for cyclic error control codes including generating a random message, generator matrix, encoding and decoding a message.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Exp - 11

The document discusses simulating linear block and cyclic error control coding schemes using MATLAB. It provides theory on linear block codes and cyclic codes. It then shows code to generate linear block code words and calculate the minimum weight. It also shows code for cyclic error control codes including generating a random message, generator matrix, encoding and decoding a message.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Expt.

No:
Date: SIMULATION OF LINEAR BLOCK AND CYCLIC ERROR
CONTROL CODING SCHEMES USING MATLAB

AIM:
To simulate of linear block and cyclic control error coding using MATLAB.

APPARATUS REQUIRED:
MATLAB software

THEORY:
• Linear block codes:
It is one of the error control coding. Linear codes means that sum of any two code
vector gives another code vector. Also it is a systematic code. Block codes in which the message
bits are transmitted in unaltered form are called systematic code.
• Cyclic code:
It is a block code, where the circular shifts of each codeword gives another word
that belongs to the code. They are error-correcting codes that have algebraic properties that are
convenient for efficient error detection and correction.

LINEAR BLOCK CODE:


clc; clear;
% Given generator matrix
G = [1 0 0 0 1 1 1;
0 1 0 0 1 1 0;
0 0 1 0 1 0 1;
0 0 0 1 0 1 1];

% Calculate code words


k = size(G, 2);
code_words = [];
for i = 1:2^k
u = zeros(1, k);
for j = k:-1:1
OUTPUT:
if rem((i-1), 2^(-j+k+1)) >= 2^(-j+k)
u(j) = 1;
else
u(j) = 0;
end
end
code_words = [code_words; rem(u * G, 2)];
end

% Calculate minimum weight


w_min = min(sum(code_words(2:2^k, :)));

disp(w_min);

CYCLIC ERROR CONTROL CODE

clc;
% Parameters
n = 7; % Code length
k = 4; % Number of message bits

% Generate random message


disp('MESSAGE');
m = randi([0 1], 2, k); % Randomly generate a message
disp(m);

% Generate generator matrix


disp('GENERATOR MATRIX');
G = [1 0 0 0 1 1 1;
0 1 0 0 1 1 0;
0 0 1 0 1 0 1;
0 0 0 1 0 1 1];
disp(G);
% Encode message
OUTPUT:
disp('CODE VECTOR');
code = mod(m * G, 2); % Encode the message using the generator matrix
disp(code);

% Decode received message


disp('DECODED MESSAGE');
decoded_msg = code * G'; % Decode the received message
decoded_msg = mod(decoded_msg, 2);
disp(decoded_msg);

AIM &
PROCEDURE
CODING VIVA

RESULT:
Thus the of linear block and cyclic control error coding was generated using MATLAB.

You might also like