MATLAB Answers

How to get number of factors after factorizing a symbolic function?

10 views (last 30 days)
Bill Tubbs
Bill Tubbs on 6 Jul 2020
Commented: Bill Tubbs on 6 Jul 2020
I'm using factor to factorize a symbolic polynomial.
Works well but when the result is a symbolic vector containing the factors, I'm not sure how to determine how many factors it contains. I tried using size but I get some inconsistent results:
>> G(s) = s^2 + 3*s + 2;
>> F = factor(G, s)
F(s) =
[ s + 2, s + 1]
>> size(F)
ans =
1 1
>> F = factor(G(s), s)
F =
[ s + 2, s + 1]
>> size(F)
ans =
1 2
>>
Note, the size is different in the second example. The only difference is that I used factor(G(s), s) rather than factor(G, s). What is the difference and why does the result (F) look the same but the size is not the same?
  2 Comments

Sign in to comment.

Accepted Answer

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!