MATLAB: Optimizing nonlinear system, difficult objective function

MATLABnonlinearobjective-functionodeoptimizationOptimization Toolboxrobot

Hi, I am trying to write a MATLAB script that optimizes a ball throwing robot where the objective is to throw the ball as far as possible.
The equations of motion are of the form: M(q)d2q + C(q,dq)dq + G(q) + K(q) = T
The ball is released from the robots grip when it crosses the y-axis, and the distance thrown is calculated. The objective function is then: F = -d^2
Now, since the distance is only computed after a simulated pitching motion of the robot, the objective function is not a smooth and nice-to-work with objective function. Inside the objective function, I must simulate the pitching and give a function evaluation back to fmincon.
What I am wondering about is how to go about this problem, just point me in the right direction… How can I simulate the robot with the input sequence that fmincon gives me? ODE solver?

Best Answer

There is a similar but simpler example in the documentation of Global Optimization Toolbox, but the example works for fmincon as well (interior-point algorithm for sure).
Alan Weiss
MATLAB mathematical toolbox documentation
Related Question