In a symbolic expression, how can I extract all terms that have a common specific variable?

35 次查看(过去 30 天)
Hello,
In a symbolic expression, is there a way to extract all terms that have a common specific variables? For example, if I have the symoblic function
dxdt = f(a,b,c)*x1+f(a,b,c)*x2+f(a,b,c)*x1+f(a,b,c)*x3+...
Is there a way to extract all terms in dxdt that have x1 in them? I'm looking to try to put my expression dxdt in standard state space form. (My symbolic function can be very lengthy, so using the simplify function is not necessarily grouping all the x1 terms together.)
Thank you, Kevin

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-3-21
编辑:Azzi Abdelmalek 2013-3-21
Use collect function
collect(dxdt,x1)
and coeffs function

更多回答(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