Question: NLPSolve or LSSolve?

For LSSolve I have the objective function as a procedure that calls another procedure (procPatientres) according to below:

p:=proc(x::Vector, y::Vector)

y[1]:=procPatientres("patient specific parameters", x[1],x[2]);

y[2]:=procPatientres("patient specific parameters", x[1],x[2]);

end proc;

This is a test example where I only fit to patients. Since the returned residuals, y[1] and y[2], are just values the first derivative is simple zero and I get the same warning message as posted above. However, I don't see how I can use fdiff in this case to provide the derivative, because the procedure procPatientres is quite complicated.

Now I have adjusted the code for NLPSolve to be able to use Nelder-Mead's method because it's derivative free. I don't know if this is better than using LSSolve, anyway I tried and it still doesn't work. The file you can find below. In short I want to minimize the sum of squares between observed carbon-14 concentrations in patients and estimated carbon-14 concentrations when testing different turnover rates (defined by the problem parameters g0 and g1).

Kindly,

Sofia

    Least_square_fit_scE.mw

 

 

Please Wait...