0% found this document useful (0 votes)
83 views8 pages

Itc Project

The document describes a student project that implemented Shannon's binary encoding algorithm in Matlab. The project involved encoding messages based on the probabilities of different symbols. It calculated the alpha sequences, determined code lengths, converted alpha values to binary, and generated code words. The output showed the encoded probabilities, code words, and lengths. Applications of Shannon coding include removing noise in communication and quantifying communication in a way that helps evaluate efficiency.

Uploaded by

OutLaw Lucifer
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)
83 views8 pages

Itc Project

The document describes a student project that implemented Shannon's binary encoding algorithm in Matlab. The project involved encoding messages based on the probabilities of different symbols. It calculated the alpha sequences, determined code lengths, converted alpha values to binary, and generated code words. The output showed the encoded probabilities, code words, and lengths. Applications of Shannon coding include removing noise in communication and quantifying communication in a way that helps evaluate efficiency.

Uploaded by

OutLaw Lucifer
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/ 8

SDM COLLEGE OF ENGINEERING AND TECHNOLOGY,

Dharwad-580002
(An autonomous Institution affiliated to
Visvesvaraya Technological University, Belagavi – 590018)

Department of Electronics and Communication Engineering

A report on CTA activity entitled,


\[;ok98j
“Shannon’s Binary Encoding Algorithm Using Matlab”

Proposed by
Mr. Akhilesh Nelavigi – 2SD20EC008
Mr. Anand Avati – 2SD20EC014
Mr. Kirankumar Mudenoor – 2SD20EC049
Mr. Sumit Halabhavi – 2SD20EC110

Students of 5th Semester ECE Department


Division : B
Course Instructor : Prof. M.Vijay Kumar
Department of ECE, SDMCET, Dharwad
Academic Year 2022-2023

1|Pa ge Department of ECE, SDMCET, Dharwad-02


TABLE OF CONTENTS

SL. No. Title Page No.

1. Introduction 3

2. Proof 3

3. Steps Involved 4

4. Source Code 5

5. Output Observed 7

6. Applications 8

2|Pa ge Department of ECE, SDMCET, Dharwad-02


1. INTRODUCTION
Shannon coding was introduced by Claude Shannon as a proof technique in his
noiseless coding theorem. Shannon Coding can be algorithmically useful. It is also
called as noiseless coding theorem. Shannon’s source Coding theorem establishes
the limits to possible data compression. The theorem tells that it is not possible to
compress the data such that the code rate is less than the Shannon entropy of the
source - else loss of information. This theorem places an upper and a lower bound
on the minimal possible expected length of code words as a function of H(S) and
size of the word length.

2. PROOF

3|Pa ge Department of ECE, SDMCET, Dharwad-02


3. STEPS
There are 5 encoding steps, as follows:-
Step 1 : List the source symbols in the order of decreasing probabilities.
Step 2 : Compute the alpha sequences.
Step 3 : Determine the smallest integer value of li using the inequality.
Step 4 : Expand the decimal number alpha in binary form up to li places
neglecting expansion beyond li places.
Step 5 : Remove the binary point to get the desired code.

4|Pa ge Department of ECE, SDMCET, Dharwad-02


4.SOURCE CODE
Tool used: MATLAB

clc;clear all;close all;


x=input('Enter number of message symbols :\n');
N=length(x);
disp('stage 1 : decreasing order of the input sequence')
p=sort(x,'descend');
disp(p)
%*****************
disp('stage 2 : following squences of alpha are calculated')
alpha(1)=0;
for i=1:N
alpha(i+1)=(alpha(i)+p(i))
end
disp(alpha)
%****************
disp('stage 3 : smallest integer value of li')
for i=1:N
l(i)=nextpow2(1/p(i));
end
disp(l)
%******************
disp('Stage 4 : Decimal to Binary conversion of alpha values');
for k=1:N
a=alpha(k);
b_prob(k)=0;
for j=1:10;
a=a*2;
if(a==1)
b_prob(k)=b_prob(k)+(0.1)^j;
break;
else if(a>1)
a=a-1;
b_prob(k)=b_prob(k)+(0.1)^j;
end
end
end
end
disp(b_prob);
%**************
disp('Stage 5 :Generate the Code Word');
for j=1:N
a=l(j);alpha=b_prob(j);

5|Pa ge Department of ECE, SDMCET, Dharwad-02


for k=1:a
alpha=alpha*10;
if alpha>=1
alpha=alpha-1;
code_word(j,k)='1';
else if alpha<1
code_word(j,k)='0';
end
end
end
end
fprintf('Probabilities\t\tCode word\t\tLength\n');
for n=1:N
fprintf('%f\t\t\t%s\t\t\t\t %d',p(n),code_word(n,:),l(n));
fprintf('\n');
end
%******************
disp('->Avg Lenght');
L=0;
for i=1:N
L=L+p(i)*l(i);
end
disp([num2str(L), ' Binits/symbol']);
%*****************
disp('->Calculate H(s) value for the input probablities');
H=0;
for i=1:N
H=H+x(i)*log2(1/x(i));
end
disp([num2str(H),' bits/symbol']);
%******************
disp('->Code efficiency Nc');
Nc=(H/L)*100;
disp([num2str(Nc),'%']);
%******************
disp('->Code redundancy RNc');
RNc=100-Nc;
disp([num2str(RNc),'%']);
%*******************
disp(' End');

6|Pa ge Department of ECE, SDMCET, Dharwad-02


5. OUTPUT OBSERVED

7|Pa ge Department of ECE, SDMCET, Dharwad-02


6. APPLICATIONS
 Concept of noise helps in making the communication effective by
removing the noise or problem causing noise.
 This model takes communication as a two way process. It makes the model
applicable in general communication.
 Communication is taken as quantifiable in Shannon model.
 It is easy to use and gives fairly efficient binary codes.
 The technique is easy but laborious process.

8|Pa ge Department of ECE, SDMCET, Dharwad-02

You might also like