Effacer les filtres
Effacer les filtres

Finding roots of symbolic expression

22 vues (au cours des 30 derniers jours)
Aleem Andrew
Aleem Andrew le 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?

Réponse acceptée

Walter Roberson
Walter Roberson le 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

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by