From: joshua on 8 Oct 2009 22:08 Hi I am trying to fit a curve using the Heligman and Pollard to the mortality rate. Basically I have data for y and t(different ages) and I was trying the LMFsolve function in Matlab to find the coefficient of the 8 parameters. However the function appears to be very sensitive to the intial value and hence the results seem wierd. Is there a better method to fit the mortality rate into this maths equation? Because the results does not fit the data very well. Anyway these are the code that I used for LMFsolve. Can anyone please help me have a look at these codes and see if there is any mistakes. Thanks. y; %a vector of real mortality rate t=[0:1:105]'; res = @ (x) (x(1)^((t+x(2))^x(3)))+x(4)*(exp(-x(5)*(((log(t)-log (x(6)))^2))))+x(7)*((x(8)^(t)))-f; for i=1:106 res = @ (x) (x(1)^((t(i)+x(2))^x(3)))+x(4)*(exp(-x(5)*(((log(t(i))-log (x(6)))^2))))+x(7)*((x(8)^(t(i))))-f; end x0=[0.00046489,0.0460,0.11778316,0.00098792,1.69283068,39.5606597,0.0000058289,1.12249078]; [x,ssq,cnt] = LMFsolve(res,x0,'Display',1,'MaxIter',10000) Joshua
|
Pages: 1 Prev: alternative to delaunayn Next: Does xcorr with 'coeff' option return Pearson's r values? |