Using factor on symbolic expression but not always factorizing

조회 수: 6 (최근 30일)
Bill Tubbs
Bill Tubbs 2020년 7월 6일
댓글: Bill Tubbs 2020년 7월 6일
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?

채택된 답변

madhan ravi
madhan ravi 2020년 7월 6일
factor(s^2+4*s+1,s, 'FactorMode', 'real')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by