Main Content

Representation of Polynomials in Communications Toolbox

You can specify polynomials as a character vector or string scalar by using a variety of syntaxes. Communications Toolbox™ functions that support character vector and string scalar polynomials convert these various syntaxes into the appropriate form, which varies depending on the function. For example, the comm.BCHEncoder function expresses polynomials as a binary row vector with powers in descending order.

When specifying a character vector or string scalar to represent a polynomial:

  • Ascending or descending order is valid.

  • Spaces are ignored.

  • The caret symbol, ^, which indicates the presence of an exponent, is optional. If omitted, the function assumes that the integer that follows the variable is an exponent.

  • Braces, {}, denote an exponent. For example, you can represent x2 as x{2}.

  • Text appearing before the polynomial expression (with or without an equals sign) is ignored.

  • Punctuation that follows square brackets is ignored.

  • Exponents must be uniformly positive or uniformly negative. Mixed-sign exponents are not allowed. For example, 'x^2 + x + 1' and '1 + z^-6 + z^-8' are valid, but '1 + z^6 + z^-8' is not valid.

This list shows some examples of how to express the polynomial x14 + 4x5 + x3 + 2x + 1 in code. Use single quotes for character vectors (as shown) or double quotes for string scalars.

  • '1+2x+x^3+4x^5+x^14'

  • '1+2m+m3+4m5+m14'

  • 'q14 + 4q5 + q3 + 2q + 1'

  • 'g(x) = 1+2x+x3+4x5+x14'

  • 'g(z) 1+2z+z3+4z5+z14'

  • 'p(x) = x{14} + 4x{5} + x{3} + 2{x} + 1'

  • '[D14 + 4D5 + D3 + 2D + 1]'

See Also




Related Topics