Fitting Gamma to a curve with two peaks

6 views (last 30 days)
untitled.png
I have a curve with two peaks and I want to fit it using sum of two Gamma function. But I don't know how to do it. Thanks for your help.

Accepted Answer

Image Analyst
Image Analyst on 11 Aug 2019
Attached is a demo where I fit two Gaussians. Adapt to your gamma functions.

More Answers (1)

John D'Errico
John D'Errico on 11 Aug 2019
This is a mistake that many people make.
They know how to fit a model to a curve. But the model they know how to use does not fit, so they try some other model form, for no real good reason for the choice, except that it might work. When that happens, I suggest they have made a mistake, because they had no physical reason for the choice of model, they just picked some form out of the blue.
In that case, the solution is often to recognize that splines are a great choice. You can use an interpolating spline, although when you have a baseline as you do, pchip may be a better choice. If you want to do some smoothing, then my SLM toolbox can offer that, while still offering the ability to not go below the baseline, etc.
The important point is to know why you want to fit a given model. Do you just want a smooth plot? USE A SPLINE! Do you just want something you can use for computations, to make predictions? Again, use a spline! Do you really need to be able to write down a model, with some coefficients? (WHY?)
Don't fit a model for the wrong reasons.

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!