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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!