Matlab 使用优化工具时如何使用输入参数?
main.m 我的乐趣Matlab 使用优化工具时如何使用输入参数?,matlab,optimization,Matlab,Optimization,main.m 我的乐趣 ... param = ...; x0 = [0,0]; [newX, fval] = fminimax(@myfun, x0) ... 如何将参数“param”传递到myfun文件 我试图喜欢以下内容,但出现了错误 function f = myfun(x) f(1)=function of (x, param); f(2)=another function of (x, param); f(3)=... ... f(5)=the last fu
...
param = ...;
x0 = [0,0];
[newX, fval] = fminimax(@myfun, x0)
...
如何将参数“param”传递到myfun文件
我试图喜欢以下内容,但出现了错误
function f = myfun(x)
f(1)=function of (x, param);
f(2)=another function of (x, param);
f(3)=...
...
f(5)=the last function of (x, param);
end
及
总的来说,您希望创建新函数。像这样:
function f = myfun(x, param)
f(1)=function of (x, param);
f(2)=another function of (x, param);
f(3)=...
...
f(5)=the last function of (x, param);
end
如需进一步参考,请查看:
function f = myfun(x, param)
f(1)=function of (x, param);
f(2)=another function of (x, param);
f(3)=...
...
f(5)=the last function of (x, param);
end
param = ...;
myfuncinclparam = @(x0)myfun(x0,param)
x0 = [0,0];
[newX, fval] = fminimax(@myfuncinclparam, x0)