MATLAB: How to simplify a symbolic polynomial with respect to x simplify polynomial Thanks. What I want is: syms a b c xequ = (x-a)*(x-b)+(x-c)%some codeans = x^2-(a+b-1)*x+a*b-c Best Answer Hi,use thecollectcommand:syms a b c xequ = (x-a)*(x-b)+(x-c)f = collect(equ)gives:f = x^2 + (1 - b - a)*x - c + a*bwhich is the version you want sorted by powers of x - just a little bit rewritten, but following your wishes.Best regardsStephan Related SolutionsMATLAB: Evaluating a function defined by “sym” command Use subs:syms a b xf = a*x^2+b*x;subs(f,{a,b,x},{1,2,magic(3)})And for more info:doc subs MATLAB: Subs(): Unexpected simplification behaviour As you mentioned, "subs" should return "Gr2 = 2*A -B". I have notified the development team here at MathWorks about this behavior and they will hopefully resolve this in a future release. Related QuestionSimplifying symbolic expression in terms of other variablesSimplify Boolean/logical expressionCant simplify an algebraic equation
Best Answer