因此,我使用以下代码优化了我的功能:
function [fval, z, Z, x] = fCarterFunction
%Searches parameter space for the best values given the model and LSE
A = [];
b = [];
Aeq = [];
beq =[];
options = optimset('Display','iter', 'Algorithm', 'interior-point');
options.MaxFunEvals = 100000;
options.MaxIter = 100000;
[pOPT, fval] = fmincon(@(p)fRSS(p),[.01 .01 .01],A, b, Aeq, beq, 0, 1, [], options);
z = pOPT(1);
Z = pOPT(2);
x = pOPT(3);
end
问题是,当我在函数上运行它时,它返回以下内容:
Warning: Length of lower bounds is < length(x); filling in missing lower bounds with - Inf.
> In checkbounds at 34
In fmincon at 332
In fCarterFunction at 12
In RunRSSfunc at 1
In run at 64
Warning: Length of upper bounds is < length(x); filling in missing upper bounds with +Inf.
> In checkbounds at 48
In fmincon at 332
In fCarterFunction at 12
In RunRSSfunc at 1
In run at 64
我不明白的是,我为以前的数据集运行了此程序,但我没有遇到任何问题。现在,matlab正在取代我的上限和下限。有谁知道如何解决这一问题?如果您需要查看实际迭代数据的其他函数,然后通过最小二乘法将仿真与实际值进行比较,请告诉我。谢谢!
正如@grantnz指出的那样,请尝试:
[pOPT, fval] = fmincon(@(p)fRSS(p),[.01 .01 .01],A, b, Aeq, beq, [0 0 0], [1 1 1], [], options);
fmincon
期望所有变量的上/下值。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句