Fit 2 parameters with fminsearch and use ODE15s to solve single differential equation
3 views (last 30 days)
Show older comments
Hello ! I am currently working on a project looking at tumor growth. I have to try different mathematical models from the litterature and fit them using some data.
For the momment I am trying to fit the Gompertz model of a tumor grotwh which is the following differential equation: (a-b*ln(v))*v)
In my code a is p(1) ; b is p(2) ; v is y(1).
I have made a first file to solve the differential equation.
Then I made a second file to fit the model with some data that I've got.
My code seems to work but I am getting estimated parameters very different from what I was expected which was around 1 or even less for a and b respectively. Also I shouldn't get a negative value.
I have tried to follow some previous examples of the MATLAB answers from Star Strider, so I am not at all sure about what I have done.
If someone could tell me if my code is correct It would be much appreciated. I have attached my 2 files.
Thanks in advance !!!
1 Comment
Soomin Lee
on 28 Jun 2022
How did you get p0 values which are educated guess of parameter y(1) and y(2)?
Accepted Answer
Star Strider
on 16 Dec 2019
Using that model of the Gompertz equation, your code is correct.
If you want to avoid negative rate constants, use lsqcurvefit instead, with constraints on the lower limits of the parameters:
B = lsqcurvefit(@fit_GompModel, p0, t, y, [0 0])
producing:
B =
68.5834500164402
6.38601980323603e-12
This give a straight line, however that is likely the best you can do. I doubt that ga (genetic algorithm) or other solvers will produce any different result, although I did not try them.
6 Comments
Star Strider
on 19 Dec 2019
I cannot get your model and data to work with fitnlm. I am not certain what the problem is, however it may be that there are too few data. It works with nlinfit, however the parameters are both negative, so the statistics would be irrelevant.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!