ode45, simulink
5 ビュー (過去 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 で Symbolic Math Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!