p2 =
2*x^4 + 3*x^2 + 2*x - 7Find the roots of the polynomial by passing the coefficients to the roots function.roots(p1.coef)ans =2.0946 + 0.0000i
-1.0473 + 1.1359i
-1.0473 - 1.1359iAdd the two polynomials p1 and p2.MATLAB calls the plus method defined for the DocPolynom class when you add two
DocPolynom objects.p1 + p2ans =2*x^4 + x^3 + 3*x^2 - 12DocPolynom Class Synopsis
Example Code Discussion
classdef DocPolynom Value class that implements a
data type for polynomials.
properties
coef
endVector of polynomial coefficients
[highest order ... lowest order]
methods For general information about
methods, see “Ordinary
Methods” on page 9-819 Defining Custom Data Types