I have the following function which I wan to use in optimisation toolbox:
function diff = fit_simp_optim()% This function is called by lsqnonlin.
% x is a vector which contains the coefficients of the
% equation. X and Y are the option data sets that were
% passed to lsqnonlin.
X=xlsread('QS2T.xls',9,'V638:C1835');Y=xlsread('QS2T.xls',9,'W638:W1835');diff = (A+B*(X.^n)) - Y;end
Now, in my command window I type:
>>optimtool
I get the optimisation toolbox;
In the optimisation toolbox,
1)corresponding to to the solver i select, lsqnonlin
2)then corresponding to algorithm, I select Trust region reflective
3)then corresponding to objective function i type @fit_simp_optim() which is the name of my .m function file
4)derivatives approximated by solver
5)Start point i give (which is for constants A,B,C- see my function above):[800;1537;0.1448]
6)Lower bound as [800;0;0] and Upper bound as [1600;6000;10]
Howver, when i start, it starts optimising but then says 'too many input arguments'
Please can anyoone help.
Best Answer