ode45, simulink

조회 수: 1 (최근 30일)
Chokri Sendi
Chokri Sendi 2019년 11월 28일
댓글: Star Strider 2019년 11월 29일
I need to solve two sets of coupled differential equations, dx = f(x,u) and du = g(x,u), using ode45. Part of du = g(x,u) involve symbolic computation but the output of both dx and du are numeric , both f(x,u) and g(x,u) are very lengthy 200 lines of code.
function dx = dynamic_model(x,u)
dx(20:1,1) = f(x,u)
end
function du = MPC(x,u)
du(3:1,1) = g(x,u)
end
I need to solve them simultanesly, Unfortunetly Simulink dont allow symbolic computation. I may write a for-loop to solve them simultaneously, but I think the stepsize would be a problem since the system is highly non-linear. Thank you for your help
  댓글 수: 1
Star Strider
Star Strider 2019년 11월 29일
I have no idea what your symbolic system is. See if the matlabFunction function will work to convert your ordinary differential equations to a form ode45 can use.
For helpful examples, use Search Answers and search using matlabFunction as the search string. There are probably hundreds of threads that begin with symbolic differential equations, then use odeToVectorField and matlabFunction to convert them to anonymous functions (or function files) that the ODE solvers can use.

댓글을 달려면 로그인하십시오.

답변 (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