# Finding two highest peaks in a chunk of samples

Supose I have a list of 600 samples of numbers, and the histogram of the samples looks like the following:

As can be seen, there are two 'mountains' of values around 16 and 48, and a outlier in 95. I would like to implement an algorithm for retrieving this values: 16 and 48.

Any help will be appreciated,

-

If you know that there are only two peaks, you can try to fit the data with a sum of two Gaussians: $$f(x) = A_1 \exp(-w_1 (x-x_1)^2) + A_2 \exp(-w_2 (x-x_2)^2)$$ Matlab has a curve fitting toolbox that should be able to solve this.