| Communications Toolbox | ![]() |
Display a polynomial in traditional format
Syntax
Description
gfpretty(a)
displays a polynomial in a traditional format, using X as the variable and the entries of the row vector a as the coefficients in order of ascending powers. The polynomial is displayed in order of ascending powers. Terms having a zero coefficient are not displayed.
gfpretty(a,st)
is the same as the first syntax listed, except that the content of the string st is used as the variable instead of X.
gfpretty(a,st,n)
is the same as the first syntax listed, except that the content of the string st is used as the variable instead of X, and each line of the display has width n instead of the default value of 79.
| Note For all syntaxes: If you do not use a fixed-width font, then the spacing in the display might not look correct. |
Examples
The code below displays statements about the elements of GF(81).
p = 3; m = 4; ii = randint(1,1,[1,p^m-2]); % Random exponent for prim element primpolys = gfprimfd(m,'all',p); [rows, cols] = size(primpolys); jj = randint(1,1,[1,rows]); % Random primitive polynomial disp('If A is a root of the primitive polynomial') gfpretty(primpolys(jj,:)) % Polynomial in X disp('then the element') gfpretty([zeros(1,ii),1],'A') % The polynomial A^ii disp('can also be expressed as') gfpretty(gftuple(ii,m,p),'A') % Polynomial in A
Below is a sample of the output.
If A is a root of the primitive polynomial 3 4 2 + 2 X + X then the element 22 A can also be expressed as 2 3 2 + A + A
| gfmul | gfprimck | ![]() |