find the minimum objective for a given ode as boundary value problem

2 views (last 30 days)
Marko on 17 Jan 2022
Edited: Torsten on 17 Jan 2022
Hello Community,
could you give me hint how to tackle this problem.
I have an ode (c has a positive value):
dxdt2 = a+b*t - c*dxdt^2;
with this boundary conditions:
t(0) = t0;
x(0) = x0;
dxdt(0) = v0;
x(end) = xEnd;
dxdt(end) = vEnd;
dxdt2(end) = 0;
and with these unkowns:
a is positive;
b is either positive or negative
also the objective funktion an energy metric have to be minimzed:
E = Integral of c*dxdt^2 from t0 to tEnd
So at first i have to define the ode-function and the objective-function.
But do i need the bvp solver and the fmincon-solver?
Thank you in advance.

Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 17 Jan 2022
For examples of optimizing a function given as the solution to an ODE, see Fit ODE, Problem-Based and Fit an Ordinary Differential Equation (ODE). These examples minimize a sum of squared difference between a given curve and the ODE solution, but the techniques apply to your problem as well. For more information, see Optimizing a Simulation or Ordinary Differential Equation.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (1)

Torsten on 17 Jan 2022
Edited: Torsten on 17 Jan 2022
Vector of unknowns for fmincon:
Objective for fmincon:
f(a,b,c,tend) = integral_{t=0}^{tend} c*(dx/dt)^2
Can be obtained by solving with ODE45
z' = c*x2^2 , z(0) = 0
x1' = x2 , x1(0) = x0
x2' = a+b*t-c*x2^2, x2(0) = v0
in [0 tend]
z(end) is the value to be returned
Constraints (to be supplied in nlcon):
ceq(1) = x2(end) - vend == 0
ceq(2) = a+b*tend-c*x2(end)^2 == 0
x2(end) can be obtained by solving with ODE45
x1' = x2 , x1(0) = x0
x2' = a+b*t-c*x2^2, x2(0) = v0
in [0 tend]
Upper and lower bounds:
a >= 0
tend >= 0 ?




Community Treasure Hunt

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

Start Hunting!

Translated by