EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 panphp 于 2020-7-8 13:45 编辑 / H% ~/ |% V& s* @9 ~6 [) t2 g
8 P' s6 F# c4 k: l$ E
matlab 实用教程——第四章 MATLAB的数值计算功能
8 r' _# d1 Y+ J: E
/ a6 L4 V5 I, z1 K) `1 \& _% v9 j1 a4 k- F4 z+ C3 h6 |
Chapter 4: Numerical computation of MATLAB 数值计算是MATLAB最基本、最重要的功能,是MATLAB最具代表性的特点。MATLAB在数值计算过程中以数组和矩阵为基础。数组是MATLAB运算中的重要数据组织形式。前面章节对数组、矩阵的特征及其创建与基本运算规则等相关知识已作了较详尽的介绍,本章重点介绍常用的数值计算方法。 一、多项式(Polynomial)` 多项式在众多学科的计算中具有重要的作用,许多方程和定理都是多项式的形式。MATLAB提供了标准多项式运算的函数,如多项式的求根、求值和微分,还提供了一些用于更高级运算的函数,如曲线拟合和多项式展开等。 1.多项式的表达与创建(Expression and Creating of polynomial) (1) 多项式的表达(expression of polynomial)_ Matlab用行矢量表达多项式系数(Coefficient),各元素按变量的降幂顺序排列,如多项式为: P(x)=a0xn+a1xn-1+a2xn-2…an-1x+an 则其系数矢量(Vector of coefficient)为:P=[a0 a1 … an-1 an 如将根矢量(Vector of root)表示为: ar=[ ar1 ar2 … arn 则根矢量与系数矢量之间关系为: (x-ar1)(x- ar2) … (x- arn)= a0xn+a1xn-1+a2xn-2…an-1x+an (2)多项式的创建(polynomial creating) a)系数矢量的直接输入法 利用poly2sym函数直接输入多项式的系数矢量,就可方便的建立符号形式的多项式。 例1:创建多项式x3-4x2+3x+2 poly2sym([1 -4 3 2]) ans = x^3-4*x^2+3*x+2 POLY Convert roots to polynomial. POLY(A), when A is an N by N matrix, is a row vector with N+1 elements which are the coefficients of the characteristic polynomial, DET(lambda*EYE(SIZE(A)) - A) . POLY(V), when V is a vector, is a vector whose elements are the coefficients of the polynomial whose roots are the elements of V . For vectors, ROOTS and POLY are inverse functions of each other, up to ordering, scaling, and roundoff error. b) 由根矢量创建多项式 已知根矢量ar, 通过调用函数 p=poly(ar)产生多项式的系数矢量, 再利用poly2sym函数就可方便的建立符号形式的多项式。 |