代码片段----patternsearch

来源:互联网 发布:mac 应用程序图标 编辑:程序博客网 时间:2024/05/18 02:31

http://cn.mathworks.com/help/gads/patternsearch.html


基本用法

% 定义一个 functionfunction y = er(x)    y = (x-5)^2;end% 在script中fun = @er; % 获得目标函数x_begin = 2.5; % 设置初值x_opt = patternsearch(fun, x_begin);% x_opt 就是使 fun 值最小的 x 

原创粉丝点击