% Script to compute the generator polynomial of a binary BCH (15,5,7)
% code using the Galois field F=GF(2^4) with p(x) = x^4+x+1
%
% Copyright (c) 2006. Robert Morelos-Zaragoza. All rights reserved.
warning off all
pold = 19; % x^4+x+1 in decimal
alpha = gf(2,4,pold); % Primitive element
a = conv(minpol(alpha),minpol(alpha^3)); % a(x) = m_1(x)m_3(x)
g = conv(a,minpol(alpha^5)) % g(x) = a(x)m_5(x)
% The polynomial is displayed as a vector of coefficients arranged from
% the highest (left most) to the lowest (right most) power. Check!!!