Using factor on symbolic expression but not always factorizing

8 ビュー (過去 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?
  1 件のコメント
Bill Tubbs
Bill Tubbs 2020 年 7 月 6 日
Thanks! I should have read the documentation!

サインインしてコメントする。

採用された回答

madhan ravi
madhan ravi 2020 年 7 月 6 日
factor(s^2+4*s+1,s, 'FactorMode', 'real')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by