Effacer les filtres
Effacer les filtres

Cell input to ode45 function

3 vues (au cours des 30 derniers jours)
R SIVAKUMAR
R SIVAKUMAR le 27 Août 2022
Modifié(e) : R SIVAKUMAR le 27 Août 2022
Hey Folks!
Please help me out with the problem below.
I've been trying to run a ode45 function that simulates 4 variables simulataneously. one among the 4, by itself has 7 variables inside it.
Like supposed say, I need to simulate this cell, y = {X(t),S(t),P(t),V(t)} where X,P & V are doubles. And S is a vector with values for 7 variables.
i.e. S(t) = [s1(t),s2(t),..,s7(t)].
So, is it by any means possible for me to simulate as below?
y0 = {X(t),S(t),P(t),V(t)} % Initial conditions
[t,y] = ode45(dydt, tspan, y0}
where the resulting "y" is cell output.

Réponse acceptée

Chunru
Chunru le 27 Août 2022
You can take all variables as an vector instead of cell array. For example,
y = [X(t), S_1(t), ... S_7(t), P(t), V(t)]'.
Then you need to define dydt accordingly.
ode45 does not support cell input.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by