Finding roots of symbolic expression

50 Ansichten (letzte 30 Tage)
Aleem Andrew
Aleem Andrew am 3 Nov. 2021
Beantwortet: Walter Roberson am 3 Nov. 2021
You cannot directly use the roots function to find the roots of a symbolic expression.
syms x
fx = x^2 + 2*x + 1
How do you find the roots of fx other than by typing the coefficients in an array?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 3 Nov. 2021
syms x
fx = x^2 + 2*x + 1
fx = 
p = sym2poly(fx)
p = 1×3
1 2 1
roots(double(p))
ans = 2×1
-1 -1

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by