FindPeaks() of a 1024 x 116 Matrix

X
Ximena · Jan 27, 2021 · 2K views
Question
I have a matrix that I read into MatLab that is 116 spectra (columns) each being 1024 elements (rows). Each spectrum has a peak and I'm looking to determine the following information from each spectrum: - Peak value - Peak position - Peak width at a set height, like 10% or 30% of the peak height. What I'd really like is to know the first and last x element of each peak   I've completed the Signal Processing Toolbox course and it didn't go over the FindPeaks() function. Please, any help would be greatly appreciate. Even if it's direction to a good source on the function. Thank you!
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 23, 2026
findpeaks only works on vector input; just use a loop and pass each column of your array in turn.
 
There's a fair amount of background information and examples of using findpeaks in the documentation; I'm unaware of any other tutorial but the web if full of stuff.
 
I'd suggest "just try it" and see what you get. If the spectra are only one-peaked, it seems it could hardly go wrong.
ADDENDUM
 
Since findpeaks can return anything from an empty set to some large number of peaks, you'll probably want to use a cell array to store the results initially or else wrap the call into a routine that processes the results of each column to ensure expected results rather than just presume every column will give one and only one peak. Of course, if the data are very clean, that may actually happen....I was rarely that lucky. :)
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

Get a Free Consultation or a Sample Assignment Review!