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

3 views (last 30 days)
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:
t(end)
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.
  4 Comments
Torsten
Torsten on 17 Jan 2022
Edited: Torsten on 17 Jan 2022
I see now that tend is also a free parameter. So you have 5 conditions and 6 degrees of freedom. Ok.
By dxdt2 you mean d^2x/dt^2 ? And by dxdt^2 you mean (dx/dt)^2 ?

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
Torsten on 17 Jan 2022
Edited: Torsten on 17 Jan 2022
Vector of unknowns for fmincon:
(y1,y2,y3,y4)=(a,b,c,tend)
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 ?

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!