ode45, simulink
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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 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!