How do I add in external equations in ODE45 simulation?

1 回表示 (過去 30 日間)
Daniel
Daniel 2017 年 5 月 24 日
コメント済み: Daniel 2017 年 5 月 24 日
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 Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by