【 MATLAB 】roots 函数介绍(多项式根)
roots
Polynomial roots
Syntax
r = roots(p)
Description
r = roots(p)返回由p表示的多项式的根作为列向量。
输入p是包含n + 1个多项式系数的向量,从x^n的系数开始。
系数0表示在等式中不存在的中间功率。
For example, p = [3 2 -2]
represents the polynomial 3x^2+2x−2.
根函数解决了形式为的多项式方程.
多项式方程包含具有非负指数的单个变量。
Roots of Quadratic Polynomial
Solve the equation .
Create a vector to represent the polynomial, then find the roots.
p = [3 -2 -4]; r = roots(p)
r = 2×1 1.5352 -0.8685
Roots of Quartic Polynomial
Open Live Script
Solve the equation .
Create a vector to represent the polynomial, then find the roots.
p = [1 0 0 0 -1]; r = roots(p)
r = 4×1 complex -1.0000 + 0.0000i 0.0000 + 1.0000i 0.0000 - 1.0000i 1.0000 + 0.0000i
Input Arguments
p
— Polynomial coefficients
vector
Polynomial coefficients, specified as a vector. For example, the vector [1 0 1]
represents the polynomial x^2+1, and the vector [3.13 -2.21 5.99]
represents the polynomial 3.13x^2−2.21x+5.99.
Data Types: single
| double
Complex Number Support: Yes
Tips
-
Use the
poly
function to obtain a polynomial from its roots:p = poly(r)
. Thepoly
function is the inverse of theroots
function.
-
Use the
fzero
function to find the roots of nonlinear equations. While theroots
function works only with polynomials, thefzero
function is more broadly applicable to different types of equations.
在MATLAB命令窗口中输入:doc fzero 查看fzero的相关介绍。
文章来源: reborn.blog.csdn.net,作者:李锐博恩,版权归原作者所有,如需转载,请联系作者。
原文链接:reborn.blog.csdn.net/article/details/83344228
- 点赞
- 收藏
- 关注作者
评论(0)