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

21 ビュー (過去 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
  2 件のコメント
Kevin Bachovchin
Kevin Bachovchin 2013 年 3 月 21 日
Thanks, that works.
Kevin Bachovchin
Kevin Bachovchin 2013 年 3 月 21 日
Just using coeffs by itself seems to work the same also.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by