Home > freetb4matlab > info-theory > unaryenc.m

unaryenc

PURPOSE ^

%

SYNOPSIS ^

function rval=unaryenc(val)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {} unaryenc (@var{value})
%
% This function encodes the decimal value.
% Useful if you are trying to perform golomb-rice coding
% value needs to be a number or row-vector. @var{value}
% is a non-negative number.
%
% Unary encoding of a +ve number N is done as follows,
% use N-ones followed by one zero. For instance, the  
% unary coded value of 5 will be then (111110) in base2 
% which is 31x2 = 62. From this definition, decoding follows.
%
% @example
% @group
%  message = [5   4   4   1   1   1]
%  coded = unaryenc(message)
%        @result{}  [62   30   30    2    2    2]
%  unarydec(coded)
%        @result{}  [5   4   4   1   1   1]
% @end group
% @end example
% @end deftypefn
% @seealso{unarydec}

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sat 16-May-2009 00:04:49 by m2html © 2003