参考网站:http://ww2.mathworks.cn/help/matlab/ref/fminbnd.html
1.一元函数极小值 x=fmindbnd('F(x)', a, b) ,a、b为所给小区间,在所给区间中求最小值。
%1
minx = fminbnd('x^2',-10,10);
%2
y = 'x^2';
minx = fminbnd(y,-10,10);
%3
y = @(x)x^2;
[minx,miny] = fminbnd(y,-10,10);
%4
y = @(x)x^2;
option = optimset('Display','iter','TolX',1e-10,'PlotFcns',@optimplotfval);
[minx,miny] = fminbnd(y,1,10,option);
2.无约束极小值 X=fminsearch('F(x)', a)或者 X=fminunc('F(x)', a) ,在点 a处开始并尝试求F(x)中描述的函数的局部最小值 minx
。
%1
y = @(x