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.

根函数解决了形式为

c8945f0b94addce5d0b208329e332bd6.gif的多项式方程.

多项式方程包含具有非负指数的单个变量。

Roots of Quadratic Polynomial

Solve the equation

RootsOfQuadraticPolynomialExample_eq01.png

d521f773f26153d885e6780701493bf6.gif.

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

8426be2637f8c67eda110dece0793aea.gif 

RootsOfQuarticPolynomialExample_eq01.png.

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). The poly function is the inverse of the roots function.

Use the fzero function to find the roots of nonlinear equations. While the roots function works only with polynomials, the fzero function is more broadly applicable to different types of equations.

在MATLAB命令窗口中输入:doc fzero 查看fzero的相关介绍。

本文同步分享在 博客“李锐博恩”(CSDN)。

如有侵权,请联系 support@oschina.cn 删除。

本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐