Question
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. X=xlsread('Filtered JCF PHASE 1.xlsx',4,'Z5:AC55'); Y=xlsread('JCF PHASE 1_5UP.xlsx',4,'AN5:AP55'); Z=xlsread('JCF PHASE 1_5DW.xlsx',4,'AN5:AP55'); 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);
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 24, 2026
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.
How about just using max()?
[pk_1, loc_1] = max(y1);
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related Matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →