Symbolic Vector ODE numerical solution

1 Ansicht (letzte 30 Tage)
Leonardo Dipilato
Leonardo Dipilato am 14 Jun. 2020
Kommentiert: Walter Roberson am 15 Jun. 2020
I'm trying to solve an ODE using vectorized symbolic calculus.
N = 4;
syms theta(t) [1 N]
Q = tril(ones(N));
theta = theta*Q';
eq = diff(theta, t, t) - cos(theta);
Dt = diff(theta, t);
How can I use this with ode45 or other solvers?
  1 Kommentar
Walter Roberson
Walter Roberson am 15 Jun. 2020
To use that with ode45 or similar, I recommend reading the first example for odeFunction() as it shows the steps to use to prepare symbolic differential equations for use with ode45 or similar.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Paresh yeole
Paresh yeole am 14 Jun. 2020
in your equation for 'eq', if you are looking for double differentiation then it should be
eq = diff(theta, t, 2) - cos(theta);
  1 Kommentar
Walter Roberson
Walter Roberson am 14 Jun. 2020
diff(theta, t, 2) and diff(theta, t, t) are treated the same, both become diff(theta, t, t) on output.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by