MATLAB: Using fminunc with blackbox

#blackboxfminuncMATLABminimizeroptimization

A blackbox code (obj_b3.p) defines a function that takes a vector of length 2 and returns some value based on that function. I want to find the global minimizer, and instead of guess and check I want to use fminunc (have never used before, have looked at doc and help and tried googling examples but they all have known functions that they make anonymous). To do this I intend on using a lot of x0 (guess) values.
how do i set up the basic code?
what I've tried:
v = [1;1] % creates a vector of length 2 (blackbox code won't accept a 1,2, only a 2,1)
x0=[0;0]; % Initial guess for fminunc
v = fminunc(obj_b3,x0)
matlab returns that there aren't enough inputs.
Can someone post a simple example of how to do this using a blackbox.m file (hope its obvious that the blackbox.p file does not allow one to actually see the code to evaluate).
Thanks!

Best Answer

fun = @obj_b3;
x0 = [0;0];
x = fminunc(fun,x0)
You might want to consult the documentation on optimizing a simulation or ODE in case your black-box function does not distinguish between nearby values very well.
Alan Weiss
MATLAB mathematical toolbox documentation