Simplifying/gathering expression on known variables

2 Ansichten (letzte 30 Tage)
Ivar Eskerud Smith
Ivar Eskerud Smith am 18 Okt. 2013
I am trying to do some analytical math with matlab using the symbolic toolbox, and at the end gather/simplifying the result using the known variables and expressions I have.
As an example to show what I want to do (this is just an example, not my actual code):
syms x1 x2 a b c x3 x2 = x3+cos(x1)*b; t = a*b*x1 + 30 + b + c*x2; %t will now be: b + c*(x3 + b*cos(x1)) + a*b*x1 + 30
My question is: How can I simplify this expression again to get back the inital expression a*b*x1 + 30 + b + c*x2 ? In other words, how can I make matlab replace x3+cos(x1)*b by x2 again? I have tried the simplify and collect functions, but they do not replace x3+cos(x1)*b by x2.
-Ivar

Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by