最陡的下降,Matlab

时间:2011-12-20 08:44:26

标签: algorithm matlab artificial-intelligence

f(x) = 4*(1-x(1)).^2 .* exp(-x(1).^2 - (x(2)+1).^2) - ...
    10*(x(1)/3 - x(1).^3 - x(2).^5 ) .* exp(-x(1).^2 - x(2).^2) - ...
    (1/2) .* exp(-(x(1)+1).^2 - x(2).^2)

where -5 <= x(1) <= 5 , -3 <= x(2) <= 3 

我想确定使用最陡下降最大化x*的最佳f(x)。 我发现了http://www4.ncsu.edu/~ctk/darts/steep.m,但我无法使用它。 我不明白这部分评论:

%  f = objective function,
%            the calling sequence for f should be
%            [fout,gout]=f(x) where fout=f(x) is a scalar
%              and gout = grad f(x) is a COLUMN vector
  1. 如何使用此功能?
  2. 如何修改初始条件?
  3. 如何修改步长?

1 个答案:

答案 0 :(得分:1)

  1. 您需要使用“函数句柄”传递函数。在帮助中查找。
  2. 初始条件是x0输入。
  3. 自动选择步长。