How to deconvolute Gaussian peaks with known locations and heights

4 views (last 30 days)
I have a signal with 9 or 10 peaks. I can get the peak locations by fitting a smoothing spline to the data and then using the findpeaks function. The result looks like this:
Now, I would like to deconvolute this signal by fitting a Gaussian to each peak. I am aware that the tallest peak probably has another peak to its right, and I'm smoothing too much to capture it, but I will fine tune the details later.
Since the cftool's Gaussian fitting is limited to 8 Gaussians, I create a custom fit with the function:
fittingFunc = 'a1*exp(-((x-477.73)/c1)^2)+a2*exp(-((x-489.143)/c2)^2)+a3*exp(-((x-506.111)/c3)^2)+a4*exp(-((x-542.774)/c4)^2)+a5*exp(-((x-556.308)/c5)^2)+a6*exp(-((x-572.872)/c6)^2)+a7*exp(-((x-594.385)/c7)^2)+a8*exp(-((x-603.98)/c8)^2)+a9*exp(-((x-618.726)/c9)^2)'
where I have hard-coded the peak locations. I use the following options:
opts.Lower = zeros(1,numel(pks));
opts.MaxFunEvals = 5000;
opts.MaxIter = 5000;
However, the resulting fit ends up being pretty bad:
Any ideas as to how I can do this robustly? I would like to be able to automate this for many other such signals. I eventually want to integrate over individual peaks.
  2 Comments
David Goodmanson
David Goodmanson on 24 Aug 2021
Hello Irem,
On the first plot, is there something going on per plan so that the x axis and the hard coded peak locations differ by a factor of 10?
Irem Altan
Irem Altan on 24 Aug 2021
Oh it's just because I didn't feed in the x data into findpeaks so it's just plotting the indices for each data point.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!