MATLAB , () , , .
, fminbnd:
fminbnd(hFunction,x0,xl)
hFunction , ; x0 xl .
. fplot (. 2.21.1):
>> f=inline('x^4+4*x^3-6*x^2+12*x-1','x')
f =
Inline function:
f(x) = x^4+4*x^3-6*x^2+12*x-1
>> fplot(f,[-5 5])
. 2.21.1, . :
>> fminbnd(f,-5,-3)
ans =
-3.9514
fminbnd:
>> [x,y]=fminbnd(f,-5,-3)
x =
-3.9514
y =
-145.0966
fminsearch:
fminsearch(hFunction,x0)
hFunction , ; x0 , .
. :
>> f=inline('x(1)^2+x(2)^2','x')
. 2.20.1. .
. 2.21.1. .
f =
Inline function:
f(x) = x(1)^2+x(2)^2
>> xmin=fminsearch(f,[1 1])
xmin =
1.0e-04 *
-0.2102 0.2548
, ( , ) . - .
, MATLAB , fminsearch :
[xmin,val,flag,output]=fminsearch(hFun,x0)
output , . , output.iterations . :
>> [x,val,flag,output]=fminsearch(f,[1 1])
x =
1.0e-04 *
-0.2102 0.2548
val =
1.0915e-09
flag =
output =
iterations: 38
funcCount: 69
algorithm: 'Nelder-Mead simplex direct search'
message: 'Optimization terminated:
the current x satisfies the termination criteria using...'