[MATLAB] ODE Solver in CasADi

88 views
Skip to first unread message

Prakitr Srisuma

unread,
Apr 2, 2023, 10:45:55 PM4/2/23
to CasADi
Hello,

I posted this question a few weeks ago but still no answer, and I am struggling with this. So, allow me to repost this again.

In MATLAB, I am trying to pass the decision variable into the ODE solver cvodes (see code below) to calculate the objective function, i.e., my objective function requires solving the system of ODEs. The code looks something like

T = opti.variable(); % decision variable
x = MX.sym('x');
dae = struct('x',x,'ode',ODEfunc(x,T));
F = integrator('F', 'cvodes', dae);
r = F('x0',0);
objfunc = r.xf;

Note: ODEfunc is a function that defines a system of ODEs of x and T.

This is the error message I got:
Error using casadi.integrator
.../casadi/core/integrator.cpp:58: Cannot create 'F' since [opti12_x_1] are free.


I would appreciate any suggestions.

Prakitr
Reply all
Reply to author
Forward
0 new messages