フィルターのクリア

Subexponential coding from c to matlab.

1 回表示 (過去 30 日間)
Pooja
Pooja 2013 年 8 月 7 日
I am having a C coding for the subexponential coding.Please tell me the matlab code written by me is correct and please suggest some ideas to implement the final step.
binary b= {k, if n<2^k
{floor(log2(n),if n>=2^k.
unary u= {0 if n<2^k
{b-k+1 if n>=2^k
Once these values are obtained, the code can be constructed by coding u in unary and continuing with the b LSB of n.
The matlab code written by me is as follows
function x=sec[n,k] %the value ok k is already estimated
if n<bitshift(2,k)
b=k;
u=0;
else
b=floor(log2(n));u=b-k+1;
x=[]%Once these values are obtained, the code can be constructed by coding u in unary and continuing with the b LSB of n.
I don't know to calculate x value in matlab.
The c code for calculating the code is given below
x =(((((1 < <( u )) -1) < < 1) < <( b )) | (n & ((1 < <( b )) -1)));
we build the unary code of u, which can be obtained by shifting a 1 bit u positions to the left and subtracting 1 to the result. A zero stop-bit can be added by shifting another position to the left the resulting value. The next operation is to append to this value the b LSB of n expressed in plain binary code. In order to do this the non-signicant bits of n must be discarded that is, theall-zero Most Signicant Bits (MSB) | by applying a mask that keeps the b LSB. A bit-wise OR operation with the truncated value of n will produce the required output.Once b and u are available, the subexponential code can be actually computed.
Please help me. Thankyou..
  4 件のコメント
dpb
dpb 2013 年 8 月 8 日
Not to mention you then came after me..._not_ how to make friends and win help... :(
Jan
Jan 2013 年 8 月 8 日
編集済み: Jan 2013 年 8 月 8 日
@Pooja: Contributors, who do not like to be pushed, might tend to ignore your question as a reaction. Pushing causes the impression, that somebody thinks, that his time is more important than the time of others. But it is not surprising, that the others have a different opinion.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by