Borrar filtros
Borrar filtros

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

35 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 21 de Mzo. de 2013
Editada: Azzi Abdelmalek el 21 de Mzo. de 2013
Use collect function
collect(dxdt,x1)
and coeffs function

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by