I am sorry, but I do not think that fmincon has the ability to use analytic gradients for a subset of the nonlinear constraints. What you can try to do instead (and this would take a good deal of programming on your part) is to tell fmincon that you are providing analytic gradients for all constraints. Then within the constraints where you do not have the analytic gradients available, compute those gradients (approximately) by finite differences, along the lines of what fmincon would do anyway. That way you will have the benefit of analytic gradients where they are available. But as I said, you would have to call the finite differences yourself within your constraint function.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Best Answer