Update the variables in ODE routines?

2 vues (au cours des 30 derniers jours)
Hossein
Hossein le 18 Juin 2015
Hi everyone,
I have a question concerning the ODE routines. I should model a complicated nonlinear dynamic system in time domain using ode113 (or any other one). I want to ask if it is possible to update the (by derivatives) predicted variables by easily replacing the optimized value in current time step? eg. we have the Y_1 as the variable in first time step and dY_1 its derivative can we update Y_2 while calculating dY_2 just buy putting Y_2 = .... ?
tnx all

Réponses (1)

Andrew Schenk
Andrew Schenk le 19 Juin 2015
The purpose of the ODE solver is to solve for the values of Y given a MATLAB function which provides values of dY. If you want to calculate the value of Y at a given step, the ODE solver does not need to solve for it.
You could accomplish this by removing Y2 as a variable from ode113 and instead use a persistent variable in your MATLAB function to calculate Y2 and track the past states.

Community Treasure Hunt

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

Start Hunting!

Translated by