Cell input to ode45 function

3 次查看(过去 30 天)
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.

采纳的回答

Chunru
Chunru 2022-8-27
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by