finding the start and end points of a unimodal peak

10 views (last 30 days)
Hi folks,
I am trying to automate the finding of the start and end of a peak. Many of the peaks I am looking at are gaussian. However, some of them are not.
Below are some of the results of using the findpeaks() function, using the width of the peak to deduce the start and end positions. As you can see, the results are not very promising!
  3 Comments
Teshan Rezel
Teshan Rezel on 31 Jan 2022
Hi @Turlough Hughes, it's the mass loss of a sample being burnt. In other words, it is how quickly the sample burns up!
Turlough Hughes
Turlough Hughes on 31 Jan 2022
Ah ok, so it's just one curve per experiment then, that's good to know. Could you attach the data (or something representative) as a .mat file and inidicate the ideal start and end positions?

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 31 Jan 2022
The findpeaks function might not be the best option here.
Experiment with ischange and findchangepts (Signal Processing Toolbox) to see if they will give the desired result.

More Answers (1)

John D'Errico
John D'Errico on 31 Jan 2022
Edited: John D'Errico on 31 Jan 2022
Wait a second! You are using findpeaks. It returns as one argument the peaks it finds, as well as the associated width. But you are using it on asymmetric peaks. Simply assuming that taking the peak, plus or minus half the width is silly if that peak is not a nice, symmetric curve.
For example,
x = linspace(0,1.25,1000);
y = sin(x.^10).^2;
plot(x,y)
hold on
[peaks,locs,w] = findpeaks(y,x)
peaks = 1×3
1.0000 0.9999 0.9999
locs = 1×3
1.0460 1.1674 1.2287
w = 1×3
0.1133 0.0392 0.0245
So it found a peaks at x= 1.1717, with a width of 0.4073.
Now are you seriously going to claim it is a good idea to use that width, as if the peak was symmetric?
xline(locs(1),'r')
xline(locs(1) + w(1)/2*[-1,1],'g')
The peaks you show are strongly asymmetric. They do not look even remotely look like a gaussian. I would expect something silly to happen if you arbitraily treat the peak as symmetric when you use the width returned.
Far more logical might be, since these seem to be unimodal curves, is to use findpeaks only to locate the peak location itself.
Now, since you know the baseline. Find the point where an interpolated approximation of that curve crosses the 10% point, thus a level at 10% of the difference from the baseline to the peak. There should be two such locations. I chose the 10% point arbitrarily, so it will be sufficiently above any baseline junk, yet reasnably close to the baseline.
  1 Comment
Teshan Rezel
Teshan Rezel on 31 Jan 2022
@John D'Errico thanks for this! I assumed that findpeaks returns the nearest approximation to the width of the peak, so thought that the +/- method from the position would yield a decent result.
"Now, since you know the baseline. Find the point where an interpolated approximation of that curve crosses the 10% point, thus a level at 10% of the difference from the baseline to the peak. There should be two such locations. I chose the 10% point arbitrarily, so it will be sufficiently above any baseline junk, yet reasnably close to the baseline."
May I please ask what you mean by this? I'm afraid I don't understand!

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!