[求助]fminunc和 fminsearch
f=0.1*exp(x(1)^2+x(2)^2)+x(1)^2-x(2)^2<br>用fminsearch求最小值可以<br>但用fminunc得不到正确答案<br>为什么啊?<br>[此贴子已经被作者于2006-5-21 17:35:24编辑过]
>> f=inline('0.1*exp(x(1)^2+x(2)^2)+x(1)^2-x(2)^2')
f =
Inline function:
f(x) = 0.1*exp(x(1)^2+x(2)^2)+x(1)^2-x(2)^2
>> x0=
x0 =
1 2
>> fminsearch(f,x0)
ans =
0.0000 1.5174
>> fminunc(f,x0)
Warning: Gradient must be provided for trust-region method;
using line-search method instead.
> In fminunc at 265
Optimization terminated: relative infinity-norm of gradient less than options.TolFun.
ans =
0.0000 1.5174
页:
[1]