un-mix a pdf

13 views (last 30 days)
Rachel Allen
Rachel Allen on 19 Mar 2021
Answered: the cyclist on 22 Mar 2021
I'm looking to find the 2 representative particle sizes (x-axis) of a particle size distribution (see attached fig). For a single reprentative particle size, I can compute the mean, or median. But, it looks like it is a mixture of two classes, and I'd like to find the "respresentative" particle size of each class. I thought that fitgmdist might help me here, but it looks like that function needs to start from raw values (not a pdf), and I have a pdf only.
In the figure, I think the answer I'm looking for is ~85 mum and 270 mum, the orange and yellow vertical lines. And tips on how to do this "unmixing"?
I'm
Thank you!
  3 Comments
Rachel Allen
Rachel Allen on 22 Mar 2021
Thanks, I don't remember exactly which data set I used to make that last image, but here's the data for a new one:
the cyclist
the cyclist on 22 Mar 2021
I haven't been able to get my idea to use fitnlm to work. :-(

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 22 Mar 2021
So you want the local peaks? Take a look at the islocalmax function.
  2 Comments
the cyclist
the cyclist on 22 Mar 2021
I don't think it's just peak-finding. If the distribution is a mixture of two gaussians, the modes tend to get shifted closer toward each other than the means of each gaussian. Here is a contrived example where the gaussian means are at -1.1 and 1.1, but the modes look to be around -0.8 and 0.8.
x = -3 : 0.01 : 3;
pdf_L = normpdf(x,-1.1,1);
pdf_R = normpdf(x, 1.1,1);
pdf_sum = pdf_L + pdf_R;
figure
plot(x,pdf_sum)
Rachel Allen
Rachel Allen on 22 Mar 2021
Thanks, I think this does illustrate it well. In addition, there are data sets like the figure attached, where it's easy to believe that there is a second peak, but it would be hard to find with a peak-finding function.

Sign in to comment.


the cyclist
the cyclist on 22 Mar 2021
I was doing a bit of searching on this forum, and I found this question, where @Image Analyst uploaded his Fit Multiple Gaussians code.
That function looks like it will do what you want. I struggled to adapt it to your data, but I'm not sure if I am just doing something silly at the end of a long day. But I think it's worth a look.
Note that that file is a demo that generates simulated data to illustrate the method. You won't need that part. You'll just need to insert your own.

Community Treasure Hunt

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

Start Hunting!