finding the start and end points of a unimodal peak
조회 수: 11 (최근 30일)
이전 댓글 표시
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/880005/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/880010/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/880015/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/880020/image.png)
댓글 수: 3
Turlough Hughes
2022년 1월 31일
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?
채택된 답변
Star Strider
2022년 1월 31일
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.
댓글 수: 0
추가 답변 (1개)
John D'Errico
2022년 1월 31일
편집: John D'Errico
2022년 1월 31일
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)
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!