Page 336 - Applied Numerical Methods Using MATLAB
P. 336
UNCONSTRAINED OPTIMIZATION 325
2
1.5
1
0.5
x 5
x 0 x 3 x 1 x 4 x 6 x 2
0
−0.5
−1
0 0.5 1 1.5 2 2.5 3
Figure 7.2 Process of searching for the minimum by the quadratic approximation method.
%nm712.m to perform the quadratic approximation method
clear, clf
f711 = inline(’(x.*x - 4).^2/8-1’, ’x’);
a=0;b=3; TolX = 1e-5; TolFun = 1e-8; MaxIter = 100;
[xoq,foq] = opt_quad(f711,[a b],TolX,TolFun,MaxIter)
%minimum point and its function value
[xob,fob] = fminbnd(f711,a,b) %MATLAB built-in function
7.1.3 Nelder–Mead Method [W-8]
The Nelder–Mead method is applicable to the minimization of a multivariable
objective function, for which neither the golden search method nor the quadratic
approximation method can be applied. The algorithm of the Nelder–Mead method
summarized in the box below is cast into the MATLAB routine “Nelder0()”.
Note that in the N-dimensional case (N> 2), this algorithm should be repeated
for each subplane as implemented in the outer routine “opt_Nelder()”.
We made the MATLAB program “nm713.m” to minimize a two-variable objec-
tive function
2 2
f(x 1 ,x 2 ) = x − x 1 x 2 − 4x 1 + x − x 2 (7.1.6)
1 2
whose minimum can be found in an analytical way—that is, by setting the partial
derivatives of f(x 1 ,x 2 ) with respect to x 1 and x 2 to zero as
∂
f(x 1 ,x 2 ) = 2x 1 − x 2 − 4 = 0
∂x 1
x o = (x 10 ,x 2o ) = (3, 2)
∂
f(x 1 ,x 2 ) = 2x 2 − x 1 − 1 = 0
∂x 2