Thanks for answering
I have used this for individual fitting in the following construct:
CODE PART A
validFitPersons = true(nbValidPersons,1);
for i=1:nbValidPersons
personalData = data{validPersons(i),3};
personalData = personalData(personalData(:,1)>=minAge,:);
try
opts = optimset('Algorithm', 'levenberg-marquardt');
[personalParams,personalRes,personalResidual] = lsqcurvefit(heightModel,initialValues,personalData(:,1),personalData(:,2),[],[],opts);
end
The intial starting values and the formula used to fit is given by:
CODE PART B
strcmpi(model,'jpa2')
heightModel = @(params,ages) abs(params(1).*(1-1./(1+(params(2).* (ages+params(8) )).^params(5) +(params(3).* (ages+params(8) )).^params(6) +(params(4) .*(ages+params(8) )).^params(7) )));
modelStrings = {'a','b1','b2','b3','c1','c2','c3','e'};
if strcmpi('male',gender)
initialValues = [175 0.35 0.12 0.076 0.43 2.8 20 0.34];
else
initialValues = [162 0.43 0.13 0.089 0.48 2.9 16 0.4];
end
Switching off the catch command in CODE PART A and adding the levenberg-marquandt command also in CODE PART A caused my data to be much closer towards the initial values then otherwise. This is a good thing.
How can I make my curve fitting stay looking much closer around my initial values and not spreading out too much?
Anyhelp?