How to do ARITHMETIC CODING USING MATLAB CODE
1.Introduction:-
2.Problem Statement:-
To generate TAG using the Arithmetic coding for the given probabilities sequence.
3.Program:-
clc;
clear all;
L=0;
U=1;
p1=input('enter probability of a=');
p2=input('Enter probability of b=');
p3=input('Enter probability of c=');
sym i;
for i=1:1:5
k=menu('select probability','a','b','c');
switch k
case 1
x1=0;
x2=p1;
case 2
x1=p1;
x2=p1+p2;
case 3
x1=p1+p2;
x2=1;
end
Ln=L+((U-L)*x1);
Un=L+((U-L)*x2);
L=Ln;
U=Un;
end
Tag=(L+U)/2
4.How to use this code:-
Here you have to only copy the code to MATLAB and just run it after that you have to give your probabilities values and select sequence from figure window.
5.Output :-
6.Conclusion -
Here we have successfully generate TAG for Arithmetic coding using the MATLAB.
Arithmetic coding is a technique which is used for lossy and lossless data compression.
Here we have used this coding for generation of tag by knowing the probabilities.
Here we have used this coding for generation of tag by knowing the probabilities.
2.Problem Statement:-
To generate TAG using the Arithmetic coding for the given probabilities sequence.
3.Program:-
clc;
clear all;
L=0;
U=1;
p1=input('enter probability of a=');
p2=input('Enter probability of b=');
p3=input('Enter probability of c=');
sym i;
for i=1:1:5
k=menu('select probability','a','b','c');
switch k
case 1
x1=0;
x2=p1;
case 2
x1=p1;
x2=p1+p2;
case 3
x1=p1+p2;
x2=1;
end
Ln=L+((U-L)*x1);
Un=L+((U-L)*x2);
L=Ln;
U=Un;
end
Tag=(L+U)/2
4.How to use this code:-
Here you have to only copy the code to MATLAB and just run it after that you have to give your probabilities values and select sequence from figure window.
5.Output :-
Figure Window
Command Window
6.Conclusion -
Here we have successfully generate TAG for Arithmetic coding using the MATLAB.
Comments
Post a Comment