# How to find the peak value of a graph and how to plot them?

조회 수: 46 (최근 30일)
arifahazwani AY 2020년 6월 5일
댓글: Tommy 2020년 6월 11일
Hi,
I need to find the peak value of each force for the plotted graph and locate it in the graph.
I already use findpeaks but there is no answer and no error informed.
I'm not sure the flow and how to apply the findpeaks command.
x1 = X(:,1); %the percentage
y1= X(:,2); %the force value 1
y2= Y(:,1); %the force value 2
y3= Z(:,1); %the force value 3
[pks,locs] = findpeaks (y1,x1);
findpeaks (y1, x1);
subplot(3,1,1);
plot(x1,y1,'r',x1,y2,'g',x1,y3,'b','Linewidth',3);
title('JCF HIP X');
xlhand = get(gca,'xlabel');
set(xlhand,'string','Percentage of stance phase (%)','fontsize',10)
ylhand = get(gca,'ylabel');
set(ylhand,'string',{'JCF (N)'},'fontsize',10);

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

### 채택된 답변

Tommy 2020년 6월 5일
According to the findpeaks() documentation:
"A local peak is a data sample that is either larger than its two neighboring samples or is equal to Inf. Non-Inf signal endpoints are excluded."
and
"If there are no local maxima, then pks is empty."
None of your plots have local maxima. They do each have a maximum value, but these values are all endpoints.
[pk_1, loc_1] = max(y1);
##### 댓글 수: 6이전 댓글 4개 표시이전 댓글 4개 숨기기
arifahazwani AY 2020년 6월 11일
Noted. thank youu.
Tommy 2020년 6월 11일
Happy to help!

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

### 카테고리

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

### Community Treasure Hunt

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

Start Hunting!

Translated by