当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

厦门大学数学科学学院:《高等代数》课程教学资源(应用与实验)MATLAB Lecture 6 - Polynomial

资源类别:文库,文档格式:PDF,文档页数:4,文件大小:212.63KB,团购合买
点击下载完整版文档(PDF)

MATLAB Lecture 6 School of Mathematical Sciences Xiamen University http∥gdjpkc.xmu.edu.cr MATLAB Lecture 6-Polynomial 多项式 Ref: MATLAB-Mathematics-Polynomials and Interpolation Vocabulary: polynomial多项式 root根 arithmetic operation算术运算 multiply乘法 divide除法 derivative导数 differentiation微分法 求值 action 部分分式 展开 convolution卷积 product乘积 deconvolution去卷积 quotient商 remainder余项 multiple roots重根 direct直接的 term transfer function转换函数,传递函数 ● Some functions conv decon poly polyder polyval polyvalm roots *residue polyfit Y Representing Poly nomials MATLAB represents polynomials as row vectors containing coefficients ordered descending powers >>p=[10-2-5] %represents x'-2x-5 >> sym p= poly 2sym(p) represents a polynomial in sym form sym p- X^3-2*x-5 ☆ Create polynomials >>p=[10-2-5 % represents a polynomail x'-2x-5 0 >>r=[0, 1, -1]; poly(r) %generate a polynomial x(x-D(x+1), whose roots are 0, 1,-1 >>a=[12: 3 4; poly(a) generate the characteristic polynomials of matrix Lec6-I

MATLAB Lecture 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Lec6­1 MATLAB Lecture 6 – Polynomial  多项式 Ref: MATLAB→Mathematics→Polynomials  and  Interpolation  l Vocabulary: polynomial  多项式 root  根 arithmetic operation  算术运算 multiply  乘法 divide 除法 derivative 导数 differentiation  微分法 evaluation  求值 partial­fraction  部分分式 expansion  展开 convolution  卷积 product  乘积 deconvolution  去卷积 quotient  商 remainder 余项 multiple roots 重根 direct  直接的 term  项 transfer function  转换函数,传递函数 l Some functions conv  deconv  poly  polyder polyval  polyvalm roots * residue * polyfit l Polynomials  ² Representing Polynomials MATLAB represents polynomials as  row  vectors  containing  coefficients ordered by  descending powers.  >> p = [1 0 ­2 ­5];  % represents 3 x - 2x -5 p =  1  0  ­2  ­5  >> sym_p = poly2sym(p) % represents a polynomial in sym form  sym_p =  x^3­2*x­5  ² Create Polynomials >> p = [1 0 ­2 ­5] % represents a polynomail 3 x - 2x -5 p =  1  0  ­2  ­5  >> r = [0, 1, ­1]; poly(r) %generate a polynomial  x(x -1)(x +1) ,whose roots are 0,1,­1  ans =  1  0  ­1  0  >> a = [1 2; 3 4]; poly(a) % generate the characteristic polynomials of matrix…  1 2  3 4 l l Ê - - ˆ Á ˜ Ë - - ¯ , i.e.  2  1 2  5 2  3 4 l l l l - - = - - - -

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  Lec6­2  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^3­3*x­2+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) …

ATLAB Lecture 6 School of Mathematical Sciences Xiamen University http∥gdjpkc.xmu.edu.cr compute the product of (x+2)(2x-1) 2*x^3+4*x^2-X Division( Correspond to the operations convolution and deconvolution >>a, r=decon(c, a) %dividing c by a is quotient q and remainder r Y Polynomial Derivatives q= polder(p) %computes the derivative of polynomial (x'-2x-5) >>a=[135: b=[246;c=polyder(a, b) %computes the derivative of the Ict of two polynomials [(x+3x+5)(2x+4x+6] 8305638 >>[q, d]= polyder(a, b) %computes the derivative of the quotient of two polynomial (x2+3x+5)_q(x) (2x2+4x+6)」d(x) 4164 t *Partial Fraction Expansion residue finds the partial fraction expansion of the ratio of two polynomials. This is particularly useful for applications that represent systems in transfer function form. For polynomials b and a, if there are no multiple roots b(x) P1 x- p2 P where r is a column vector of residues, p is a column vector of pole locations, and k is a row vector of direct terms >>b=[-48: a=[168[, p, k]=residue(b, a)% x2+6x+8x+4x+2

MATLAB Lecture 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Lec6­3  % compute the product of 2  (x + 2)(2x -1) ans =  2*x^3+4*x^2­x­2 Division (Correspond to the operations convolution and deconvolution) >> [q, r] = deconv(c, a) %dividing c by a is quotient q and remainder r q =  2  0  ­1  r =  0  0  0  0  ² Polynomial Derivatives >> q = polyder(p) %computes the derivative of polynomial  3  (x - 2x - 5)¢ q =  3  0  ­2  >> a = [1 3 5]; b = [2 4 6]; c = polyder(a,b) %computes the derivative of the …  product of two polynomials  2 2  [(x + 3x + 5)(2x + 4x + 6)]¢ c =  8  30  56  38  >> [q,d] = polyder(a,b) %computes the derivative of the quotient of two polynomials…  2  2  ( 3 5) ( ) (2 4 6) ( ) x x q x  x x d x ¢ È + + ˘ = Í ˙ + + Î ˚ q =  ­2  ­8  ­2  d =  4  16  40  48  36  ² *Partial Fraction Expansion residue finds  the partial  fraction expansion of the ratio of two polynomials.  This is particularly useful  for applications  that  represent  systems  in transfer function form.  For polynomials b and a, if there are no multiple roots,  1 2  1 2  ( ) ... ( ) n  s  n  b x  r r r k  a x x p x p x p = + + + + - - - where r is a column vector of residues, p is a column vector of pole locations, and k is a row  vector of direct terms.  >> b = [­4 8]; a = [1 6 8]; [r, p, k] = residue(b, a) % 2  4 8 12 8 6 8 4 2 x  x x x x - - - = + + + + + r =  ­12  8

ATLAB Lecture 6 School of Mathematical Sciences Xiamen University http∥gdjpkc.xmu.edu.cr k Given three input arguments(r, p, and k), residue converts back to polynomial form due(r, p, k)% x+4x+2x2+6x+8 Polynomial Function Summary Function Description Multiply polynomials decoy Divide polynomials Poly fied roots I Po olynomial derivative orval Polynomial evaluation olyvalm Matrix polynomial evaluation oots i Find polynomial roots. polyfit Polynomial curve fitting

MATLAB Lecture 6  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Lec6­4  p =  ­4  ­2  k =  [ ] Given three input arguments (r, p, and k), residue converts back to polynomial form.  >> [b2, a2] = residue(r, p, k) % 2  12 8 4 8 4 2 6 8 x  x x x x - - - + = + + + + b2 =  ­4  8  a2 =  1  6  8  ² Polynomial Function Summary Function  Description  conv  Multiply polynomials.  deconv  Divide polynomials.  poly  Polynomial with specified roots.  polyder Polynomial derivative.  polyval  Polynomial evaluation.  polyvalm  Matrix polynomial evaluation.  roots Find polynomial roots.  residue Partial­fraction expansion (residues).  polyfit  Polynomial curve fitting

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
已到末页,全文结束
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有