nuaayuguorui 发表于 2011-3-3 08:07:07

求助ga函数的问题:如何传递不需要优化的参数

如何传递不需要优化的参数:比如function   f=clg(s0,p1,p2,p3),其中s0是需要优化的参数,p1,p2,p3是不需要优化的参数,但是是需要传递到函数中的参数。用ga函数时怎么处理这个问题,小弟新手,求助。

qibbxxt 发表于 2011-3-3 09:03:19

function = test20110303(nvars)
% This is an auto generated MATLAB file from Optimization Tool.

% Start with the default options
options = gaoptimset;
% Modify options setting
options = gaoptimset(options,'Display', 'off');
= ...
ga(@(x)myfun(x,1),nvars,[],[],[],[],[],[],[],options);上述程序中函数function y=myfun(x,a)
% written by BB
y=x^2+a;希望对你有所帮助
页: [1]
查看完整版本: 求助ga函数的问题:如何传递不需要优化的参数