Question: Assume you have a source alphabet that includes the 5 symbols , ( eof ) function arithcoding format long N = 4 ; % this

Assume you have a source alphabet that includes the 5 symbols ,(eof) function arithcoding
format long
N=4;
%this input sequence represents the example from the screencast
% "CABBAB#"
data=[3,1,2,2,1,2,4]
%p=[14,14,14,14];
p=[[27,37,17,17];
M=length(data);
%encoding
%initialization
upbound = cumsum(p);
lobound =[0 upbound(1:end-1)];
for k1=1:M
if k1==M
finalinterval=[lobound(data(k1)) upbound(data(k1))];
else
width = upbound(data(k1))- lobound(data(k1));
newbottom=lobound(data(k1));
upbound = newbottom + cumsum(p)*width;
lobound =[newbottom upbound(1:end-1)];
end
end
finalinterval
%pick any number within the final interval for the decimal code.
%note that picking the optimal binary number is tricky, and depends on
%decimal to binary conversion details.
%we will just cheat and pic the midpoint of the interval
arith codeword = sum(finalinterval)/2%midpoint of interval
%decoding
upbound = cumsum(p);
lobound =[0 upbound(1:end-1)];
decode=[];
finished=0;
while finished==0
tu =(arith codeword
Assume you have a source alphabet that includes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!