ATLAB Lecture 6 School of Mathematical Sciences Xiamen University http∥gdjpkc.xmu.edu.cr 1.0000-5.0000-2.0000 t Polynomial Evaluation > polyval(p, 5) evaluates a polynomial at a specified value, say 5 > subs(sym p, 5) %o substitute the sym variable x in sym p with 5 110 X=[245;-103;71 >>Y=polyvalm(p, X)% create a square matrix X and evaluate the polynomial p at X Y=X3-2X-5 377179439 490253639 ☆ Polynomial Roots >>r=roots(p) calculates the roots of a polynomial p 2.0946 -1.0473+ 1.13591 1.0473 1.13591 Y Polynomial Arithmetic operation Addition >>p2=02-13: add p=p+p2 %calculates sum of two polynomials p and p2 Here the matrix dimensions must agree add p= >>p3= poly2sym(p2); add p sym= sym p+ p3 %sym p pulses p3 and display the result in sym form dd p sym x^3-3*x-2+2*x^2 > sym2poly(add p sym) returns a row vector containing the coefficients of the symbolic polynomial P Subtraction(Omit. It is similar to addition) Multiplication( Correspond to the operations convolution >a=[12; b=[20-1; c=conv(a, b); poly2sym(c)MATLAB Lecture 6 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Lec62 ans = 1.0000 5.0000 2.0000 ² Polynomial Evaluation >> polyval(p,5) % evaluates a polynomial at a specified value, say 5. ans = 110 >> subs(sym_p,5) % substitute the sym variable x in sym_p with 5 ans = 110 >> X = [2 4 5; 1 0 3; 7 1 5]; >> Y = polyvalm(p, X) % create a square matrix X and evaluate the polynomial p at X… 3 Y = X - 2X -5I Y = 377 179 439 111 81 136 490 253 639 ² Polynomial Roots >> r = roots(p) % calculates the roots of a polynomial p r = 2.0946 1.0473 + 1.1359i 1.0473 1.1359i ² Polynomial Arithmetic operation Addition >>p2 = [0 2 1 3]; add_p = p+p2 %calculates sum of two polynomials p and p2. … Here the matrix dimensions must agree. add_p = 1 2 3 2 >> p3 = poly2sym(p2); add_p_sym = sym_p + p3 %sym_p pulses p3 and display the … result in sym form. add_p_sym = x^33*x2+2*x^2 >> sym2poly(add_p_sym) % returns a row vector containing the coefficients … of the symbolic polynomial P ans = 1 2 3 2 Subtraction (Omit. It is similar to addition) Multiplication (Correspond to the operations convolution) >> a = [1 2]; b = [2 0 1]; c = conv(a, b); poly2sym(c) …