Dcom - Exp8 - LBC - 24-25 - Odd Sem

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

K. J.

Somaiya College of Engineering, Mumbai-77

Batch: A1 Roll No.: 16010322019


Experiment / assignment / tutorial No._08_
Grade: AA / AB / BB / BC / CC / CD /DD

Signature of the Staff In-charge with date

Title: Linear Block Code


Objectives:
1. To design encoder and decoder using Linear Block Code

OUTCOME: apply different methods of error control coding and schemes required for
reliable transmission of digital communication

Problem statement:
• Design theoretically a (6, 3) linear block encoder for given the
generator matrix and implement the circuit of the encoder and decoder

Procedure:
• Design a digital circuit to implement the above encoder.
Use open source simulator software: Circuit Verse (Just signup once or login with Google).
(You may use LTpsice)
Step 1: Click on the option of “Launch Simulator”, the untitled project window
appears.

Department of Electronics and Telecommunication Engineering

DCL/V/July-November_2024_Page No.-
K. J. Somaiya College of Engineering, Mumbai-77
Step 2: Select the project tab of the toolbar and create a new project. Save the project in
online mode.

Step 3: Select the appropriate input, logic gate and output option from the circuit
element palette. Drag and drop the selected option on the project screen.

Step 4: Interconnect the placed elements by clicking on the two end-points. The output
changes can be visualised in real-time. Note down the corresponding input-output logic

Department of Electronics and Telecommunication Engineering

DCL/V/July-November_2024_Page No.-
K. J. Somaiya College of Engineering, Mumbai-77
Step 5: Observe the code words for all the inputs. Verify using „encode‟ function of
MATLAB.
Step 6: Design a circuit (decoder) to evaluate the syndrome from the received code
word
Step 7: Implement circuit, using software. Generate syndrome table using „syndtable‟
function of MATLAB.
Step 8: Introduce single bit error in one code word. Evaluate the syndrome for it.
Identify the error pattern. Verify results using hardware and software.

clc;
clear all;

% Input Generator maytrix


g=input('Enter the generator matrix: ')
disp('G=')
disp('The order of Linear Block code for given generator matrix is: ')
%g=[1 0 0 1 0 1; 0 1 0 1 1 0; 0 0 1 0 1 1];
[n,k] = size(transpose(g))
for i = 1:2^k
for j = k:-1:1
if rem(i-1, 2^(-j+k+1))>=2^(-j+k) u(i,j)=1;
else u(i,j)=0;
end
end
end;

disp('The Possible Codewords are: ')


c = rem(u*g,2)
disp('The minimum Hamming Distance dmin for given block codes is= ')

% Code Word
r = input('Enter the received Code Word: ')
p = [g(:,n-k+1:n)]
h = [transpose(p),eye(n-k)];
disp('Hamming Code')
ht = transpose(h)
disp('Syndrome of a given CodeWord is: ')

% Bitwise XOR addition is same as mod 2 of the result of the normal addition
s = rem(r*ht,2)
if(s==[0 0 0])
disp('No error in the codeword')
else
for i = 1:1:size(ht)
if(ht(i,1:3)==s)
r(i) = 1-r(i);
break;
end
end
disp('The error is in bit: ')
i
disp('The corrected CodeWord is: ')
r
end

Department of Electronics and Telecommunication Engineering

DCL/V/July-November_2024_Page No.-
K. J. Somaiya College of Engineering, Mumbai-77

Expected Output:
• Corresponding code vectors
• Minimum hamming distance dmin
• Error detection and error correction capability
• Parity check matrix
• Find error if received code is 1 0 0 0 1 1

Output:

Enter the generator matrix:

[1 0 0 1 0 1; 0 1 0 0 1 1; 0 0 1 1 1 0]

g=

1 0 0 1 0 1

0 1 0 0 1 1

0 0 1 1 1 0

G=

The order of Linear Block code for given generator

matrix is:

n=

k=

3
Department of Electronics and Telecommunication Engineering

DCL/V/July-November_2024_Page No.-
K. J. Somaiya College of Engineering, Mumbai-77
The Possible Codewords are:

c=

0 0 0 0 0 0

0 0 1 1 1 0

0 1 0 0 1 1

0 1 1 1 0 1

1 0 0 1 0 1

1 0 1 0 1 1

1 1 0 1 1 0

1 1 1 0 0 0

The minimum Hamming Distance dmin for given

block codes is=

Enter the received Code Word:

[1 0 0 0 1 1]

r=

1 0 0 0 1 1

Department of Electronics and Telecommunication Engineering

DCL/V/July-November_2024_Page No.-
K. J. Somaiya College of Engineering, Mumbai-77
p=

1 0 1

0 1 1

1 1 0

Hamming Code

ht =

1 0 1

0 1 1

1 1 0

1 0 0

0 1 0

0 0 1

Syndrome of a given CodeWord is:

s=

1 1 0

Department of Electronics and Telecommunication Engineering

DCL/V/July-November_2024_Page No.-
K. J. Somaiya College of Engineering, Mumbai-77
Warning: Colon operands must be real scalars. This

warning will become an error in a future release.

> In dcom8 (line 35)

The error is in bit:

i=

The corrected CodeWord is:

r=

1 0 1 0 1 1

>>

Discussion/Conclusion:

In this experiment, we successfully designed and implemented a (6,3) linear block code, both
encoding and decoding were verified theoretically and through simulation. The decoder accurately
detected and corrected single-bit errors, highlighting the effectiveness of error control coding in
ensuring reliable data transmission.

Signature of faculty in-charge

Department of Electronics and Telecommunication Engineering

DCL/V/July-November_2024_Page No.-

You might also like