Borrar filtros
Borrar filtros

Using factor on symbolic expression but not always factorizing

2 visualizaciones (últimos 30 días)
I'm trying to show both versions of a symbolic equation, one unfactorized and one factorized.
This example works as expected:
>> syms s
>> factor(s^2+2*s+1)
ans =
[ s + 1, s + 1]
However, it does nothing in this case:
>> factor(s^2+4*s+1)
ans =
s^2 + 4*s + 1
Expected:
[ s + 0.2679, s + 3.7321 ]
For reference:
>> roots([1 4 1])
ans =
-3.7321
-0.2679
Is it because the roots are not whole numbers? I.e. Does it only factorize if the factors are simple? Or am I doing something wrong?

Respuesta aceptada

madhan ravi
madhan ravi el 6 de Jul. de 2020
factor(s^2+4*s+1,s, 'FactorMode', 'real')

Más respuestas (0)

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by