Well, if you supply the gradients and set the appropriate options (set SpecifyObjectiveGradient and SpecifyConstraintGradient to true), then fmincon does not estimate the gradients numerically, so there is no point in using parallel computing. There is no parallel gradient estimation going on in this case.
Depending on the complexity of your gradient calculations, it can be faster to estimate the gradients numerically. I mean, it is possible that numerical estimation of the gradients would be faster than analytic evaluation. Set the gradient options to false and see. Of course,it is also possible that numerical estimates are slower than analytic evaluations.
Alan Weiss
MATLAB mathematical toolbox documentation
Best Answer