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 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