How to fit multiple curves to histogram subpopulations?
15 views (last 30 days)
Show older comments
Hello, I will be as succint as possible. I have a histogram and would like to fit two seperate curves to the distribution, representing the two subpopulations in the distribution. Essentially I would like to do this (red lines I drew):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/889720/image.png)
How can I do this?
Note that these arent two seperate histograms, but rather a single histogram.
My code for this histogram is here:
%%
figure;
d1=histogram(dG_TfR_100, [0: .3: 25], 'Normalization' ,'probability'); %range of current drops
ylabel('normalized event count')
I have also attached the variable dG_TfR_100 as an excel sheet in case it is needed.
Please let me know if there is any additional information you need. Thank you.
0 Comments
Answers (1)
AndresVar
on 11 Feb 2022
Edited: AndresVar
on 11 Feb 2022
You could fit a distribution to the histrogram using histfit or fitdist, then identify the number of modes or peaks, N. Then fit the distribution with the sum of N distributions, with carefully selected parameters:
Curve Fitting - MATLAB & Simulink (mathworks.com) to fit your choice of components
You can try this method that fits gaussian mixture model, it works like a k-means clustering:
Browse file exchange for helpful functions:
Here is a gaussian decomposition paper
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!