MATLAB: Getting “Index exceeds matrix dimensions”

factorhelpindex

I feel like this should be really simple. I'm doing problem 12.5 which says "Use expand, factor, collect, and simplify" on functions I've made. When I do factor on sq2 which is 5*x^5 – 4*x^4 + 3*x^3 + 2*x^2 – x == 24 is says "Index exceeds matrix dimensions. Error in sym/factor (line 106) multiplicity = c{k+1};
Please help.

Best Answer

factor() cannot be used on symbolic equations.
If you have R2017a or later, you can
factor(lhs(eq2)-rhs(eq2))
The particular eq2 that you posted has no factorization so you would get the same output as input.