defining generic function?

Hello, here's a brief overview of my problem: I have to diff some ugly equations (lots of terms with cos and sin products) with variables x (position) xdot (speed). Is there anyway I can tell matlab that x and xdot is a function of time (t) so that it can do dx/dt symbolically?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Mzo. de 2011

1 voto

You can either write all references to x and xdot as x(t) and xdot(t), or you can
neweqn = subs(eqn,{x,xdot},{sym('x(t)'),sym('y(t)')});
to effectively rewrite the equation after it is defined.

1 comentario

Eduardo
Eduardo el 5 de Mzo. de 2011
Dang, such a simple solution! Thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by