About working of cyclpoly() and encode()
4 次查看(过去 30 天)
显示 更早的评论
Here is a MATLAB code to generate cyclic codes. n=7; k=4;%This is [7,4] cyclic code. pg = cyclpoly(n,k,’all’) % Now I get two generatopr polynomials – % [1 0 1 1] and [1 1 0 1]. % ’cyclpoly()’ returns coefficients of generator polynomials in ascending powers of x. % So,[1 0 1 1] = 1 +x^2 +x^3 =x^3 + x^2 + 1 % and [1 1 0 1] = 1+ x + x^3 = x^3 + x +1. d= 0:2^k – 1; dta = de2bi(d,’left-msb’); codes = encode(dta,n,k,’cyclic’,[1 0 1 1]) % Here, I give generator polynomial (x^3 + x^2 + 1)in ascending powers of x according to format %required by encode(). I get this answer :- codes =
0 0 0 0 0 0 0
0 1 1 0 0 0 1
1 1 0 0 0 1 0
1 0 1 0 0 1 1
1 1 1 0 1 0 0
1 0 0 0 1 0 1
0 0 1 0 1 1 0
0 1 0 0 1 1 1
1 0 1 1 0 0 0
1 1 0 1 0 0 1
0 1 1 1 0 1 0
0 0 0 1 0 1 1
0 1 0 1 1 0 0
0 0 1 1 1 0 1
1 0 0 1 1 1 0
1 1 1 1 1 1 1
-----------------------------------------------------------------------------When I check manually,I get the same codes for
generator polynomial = x^3 + x +1.
Also,when I use
codes = encode(dta,n,k,’cyclic’,[1 1 0 1]);
(that is, generator polynomial = x^3 + x + 1 specified by ascending powers of x),
I get the codes given above which are for
generator polynomial = x^3 + x^2 +1 according to manual method.
For reference,I am giving procedure for generating systematic cyclic code:- 1. Write d(x) for given message bits. e.g. For d = [0 0 0 0] ; d(x) = 0 For d =[0 0 0 1] ; d(x)= 1 For d =[0 0 1 1]; d(x) = x +1 For d = [0 1 1 1]; d(x) = x^2 + x +1 2. Find x^(n-k)*d(x). 3.Divide x^(n-k)*d(x) by generator polynomial & find remainder p(x). 4.Find code(x) = x^(n-k)*d(x) + p(x). 5.Write code word corresponding to code(x).
By observation, first 4 columns obtained by manual method are nothing but 4th to 7th columns given by encode() function. Last 3 columns obtained by manual method are first 3 columns of matrix given by encode(). OKAY,NO PROBLEM ! The problem is mentioned above already. Please tell me the reason of this problem. There may be other methods to find [7,4] cyclic codes. If you wish to tell them,you are welcome! But please tell me the reason for my problem!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Error Detection and Correction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!