How do I add in external equations in ODE45 simulation?

1 次查看(过去 30 天)
Hello!
This is my state space model:
// State space
der(x1) = x2;
m1*der(x2) = -k1*(x1 - x3) + Pp*Ap*10 - Pm*Am*10 -b1*(x2 - x4) - gamma*x2;
der(x3) = x4;
M*der(x4) = k1*(x1 - x3) - k2*(x3 - L2*sin(x5)) + b1*(x2 - x4) - M*g*mu*x4;
der(x5) = x6;
1/3*m2*L2^2*der(x6) = L2*k2*(x3 - L2*sin(x5)) - k3*x5 - b2*x6 + L2/2*m2*g*sin(x5);
And this is my external functions who gives values to the state space model. How do I include this inside the ODE45 function?
// Dynamic flow
Qin = 15*R1*sqrt(P - Pp);
// Dynamic pressure
Pp = beta/(Ap*x1)*(Qin - 6*Ap*x2);
Pm = beta/(Am*(L1 - x1))*(6*Am*x2 - 6*Am*x2*R2);
This is probably very easy to do, but I don't know how to do that.
  2 个评论
Star Strider
Star Strider 2017-5-24
That does not look like MATLAB syntax.
Please post your MATLAB code.
Daniel
Daniel 2017-5-24
I don't have a MATLAB code. This is a OpenModelica code. The only who differ is the der() command. der() is the derivative.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by