ode45, simulink

2 visualizaciones (últimos 30 días)
Chokri Sendi
Chokri Sendi el 28 de Nov. de 2019
Comentada: Star Strider el 29 de Nov. de 2019
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 comentario
Star Strider
Star Strider el 29 de Nov. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by