finding the start and end points of a unimodal peak

조회 수: 3(최근 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!
  댓글 수: 3
Turlough Hughes
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
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.

추가 답변(1개)

John D'Errico
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)
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
Teshan Rezel
Teshan Rezel 2022년 1월 31일
@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!

댓글을 달려면 로그인하십시오.

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by