[go: up one dir, main page]

0% found this document useful (0 votes)
29 views2 pages

Dcom Experiment No 6

This experiment aims to write a program for generation and evaluation of variable length source coding using Huffman coding and decoding. Huffman coding is an efficient variable length coding technique that assigns shorter bit sequences to more frequent symbols to minimize the average code length. The program uses MATLAB to generate a Huffman dictionary from symbol probabilities, encode a message using the dictionary, decode the message, and calculate the average code length and coding efficiency. The experiment demonstrates Huffman coding and decoding and evaluates the average code length and efficiency.

Uploaded by

UDIT MHATRE
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)
29 views2 pages

Dcom Experiment No 6

This experiment aims to write a program for generation and evaluation of variable length source coding using Huffman coding and decoding. Huffman coding is an efficient variable length coding technique that assigns shorter bit sequences to more frequent symbols to minimize the average code length. The program uses MATLAB to generate a Huffman dictionary from symbol probabilities, encode a message using the dictionary, decode the message, and calculate the average code length and coding efficiency. The experiment demonstrates Huffman coding and decoding and evaluates the average code length and efficiency.

Uploaded by

UDIT MHATRE
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/ 2

EXPERIMENT NO:6

Aim - To write Write a program for generation and evaluation of


variable length source coding using Huffman coding and decoding.
Theory: -
HUFFMAN CODING:

Huffman coding is one of the efficient coding techniques which is variable length
coding is to assign each symbol of an alphabet sequence of bits roughly equal in
length to the amount of information conveyed by the symbol ‘n’ question.

The end result is a source code whose avg. code word length approaches the
entropy H(x) of that source.

Software Required: - MATLAB / C


Program: -
% HUFFMAN CODING
clc;
clear all;
close all;
cod length=0;
x=input ('Enter number of symbols: ');
for m=1:x
symbols(m)=input ('Enter the symbol number:');
p(m)=input ('Enter the probability: ');
end
Hx=0;
for m=1:x
[dict,avglen]=huffmandict(symbols,);
hcode=huffmanenco(m,dict)
dsig = huffmandeco(hcode,dict)
code_length=length(hcode)
Hx=Hx+(p(m)*(-log(p(m)))/ (log (2)));
end
display (Hx);
Efficiency=(Hx/avglen) *100

Conclusion: - Thus we have performed Huffman coding and


decoding.

You might also like