Simplifying/gathering expression on known variables

4 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by