|
Hi there,
In the code below I pass daily yields to lsqcurvefit.
Just want to check what lsqcurvefit does?
Does it try and fit the all the parmatmers at the same time? I.e. for each set of test parameters it fits calculates the sum of suared errors for every day (giving a daily SSE) then sums these daily SSE to give a total SSE and then try to minimise that.
Or does it find the best fit for each day and then average?
I'm assuming the former but just want to check.
.........................................................................................
%% data fitting parameters
[1] clc
[2] close all
[3] clear screen
[4] data= dlmread('yield.txt','\t');
[5] ydata=data(2:end,:);
[6] k=size(ydata);
[7] for i=1:k(1)
[8] xdata(i,:)=data(1,:);
[9] end
[10] c0 = [1 1 1 1 1 1];
[12] lbn = []; % lower bound
[13] ubn = []; % upper bound
[14] options = [15]optimset('LargeScale','on','MaxFunEvals',100000,'TolFun',1e-5,'MaxIter',10000);
[16] % datafitting
[17] [cn,error]=lsqcurvefit(@PrimePerm,c0,xdata,ydata,lbn,ubn,options);
.........................................................................................
|