ode45, simulink
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Star Strider
le 29 Nov 2019
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.
Réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!