%% Minimize with Extra Parameter
% Minimize a function when there is an extra parameter. The function \sin(x-a) has a minimum that depends on the value of the parameter a. Create an anonymous function of x that includes the value of the parameter a. Minimize this function over the interval 0 < x < 2\pi.

a = 9/7;
fun = @(x)sin(x-a);
x = fminbnd(fun,1,2*pi)

%
% This answer is correct; the theoretical value is

3*pi/2 + 9/7

% For more information about including extra parameters, see Parameterizing Functions.
% Copyright 2012 The MathWorks, Inc.