필터 지우기
필터 지우기

Peak area through Findpeak

조회 수: 4 (최근 30일)
iqra kiran
iqra kiran 2023년 7월 11일
댓글: Star Strider 2023년 7월 11일
Hello Everyone,
I have the following data: as attched m file. I can fine the peak location, width through peakfind command. Now i want to find the area under the peak. would you please guide me how i can find using findpeaks.
[pks20_4,loc20_4,w20_4,p20_4] =findpeaks(Y20_4,X4);
Thank you,

채택된 답변

Star Strider
Star Strider 2023년 7월 11일
It depends on how you define ‘peak’.
LD1 = load('X4.mat');
X4 = LD1.X4;
LD2 = load('Y20_4.mat');
Y20_4 = LD2.Y20_4;
[pks20_4,loc20_4,w20_4,p20_4] =findpeaks(Y20_4,X4)
pks20_4 = 274.4520
loc20_4 = 3.5596
w20_4 = 0.1954
p20_4 = 273.9922
[pks20_4,loc20_4ix,w20_4ix,p20_4] =findpeaks(Y20_4)
pks20_4 = 274.4520
loc20_4ix = 491
w20_4ix = 111.0153
p20_4 = 273.9922
ixv = find(diff(sign(Y20_4-105)))
ixv = 1×2
421 572
PkArea = trapz(X4(ixv(1):ixv(2)), Y20_4(ixv(1):ixv(2)))
PkArea = 50.5773
figure
plot(X4, Y20_4)
grid
hold on
xp = X4(ixv(1):ixv(2));
yp = Y20_4(ixv(1):ixv(2));
patch([xp flip(xp)], [yp zeros(size(yp))], [ 1 1 1]*0.75, 'FaceAlpha',0.5)
hold off
xline(X4(ixv), '--r')
text(mean(X4(ixv(1):ixv(2))), 105, sprintf('Area = %.3f', PkArea), 'Horiz','center')
.
  댓글 수: 6
iqra kiran
iqra kiran 2023년 7월 11일
Thanks alot.
Star Strider
Star Strider 2023년 7월 11일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by