This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Character Representation of Polynomials

You can specify polynomials as a character vector or string using a variety of syntaxes that correspond to those found in literature. The Communications Toolbox™ functions that support character vector and string polynomials internally convert them into the appropriate form. The form varies depending on the function. For example, the comm.BCHEncoder function expresses polynomials as a binary row vector whose powers are in descending order.

When specifying character vectors or strings to represent polynomials:

  • The order of the polynomial, ascending or descending, does not matter.

  • Spaces are ignored.

  • The caret symbol, ^, which indicates the presence of an exponent, is optional. If omitted, the function assumes that the integer following the variable name 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 following square brackets is ignored.

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

To illustrate these characteristics, you can express the polynomial 1 + 2x + x3 + 4x5 + x14 using any of the following examples using single quotes for character vectors as shown or double quotes for strings.

  • '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]'