Arithmetic coding, the way to find decimal representation of codeword

조회 수: 3 (최근 30일)
pando
pando 2020년 11월 7일
편집: Aghamarsh Varanasi 2020년 11월 13일
seq = [3 3 1 3 3 3 3 3 2 3];
counts = [10 20 70];
code = arithenco(seq,counts)
By implementing this code, I can get arithmetic codeword in matrix
[1 0 0 0 1 1 0 0 0 1 0 1 1 0 1 1 0 0]
it means that it is '0.100011000101101100' in binary.
I want to know average codelength to get code efficiency, so I must know convert the codeword into decimal and get length of it.
I can calculate it easily beacuse above example is not large, however I want to know how to calculate the length in large cases(my codeword in binary length is 5897909)

답변 (1개)

Aghamarsh Varanasi
Aghamarsh Varanasi 2020년 11월 13일
편집: Aghamarsh Varanasi 2020년 11월 13일
Hi,
You can get the length of the code word using 'size' function
lengthOfCodeWord = size(code,2);

카테고리

Help CenterFile Exchange에서 Error Detection and Correction에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by