Use fminunc
. If you want to use the gradient, just return it as the 2nd output of your objective function. You'll also need to indicate in an options
object that you are passing the gradient.
options = optimoptions('fminunc','GradObj','on');
I believe the documentation has info on passing the Hessian (if one exists).