- Use the "MinPeakProminence" property of "findpeaks" function with a suitable prominence value to make the peak detection better. You can refer to this link for more information about the same: https://www.mathworks.com/help/signal/ref/findpeaks.html#buff2uu:~:text=MinPeakProminence%20%E2%80%94%20Minimum%20peak%20prominence
- Use noise reduction techniques like smoothing or filtering before using "findpeaks".
- The following link might also be useful: https://www.mathworks.com/help/signal/ug/peak-analysis.html
Findpeaks based on signal frequency
4 views (last 30 days)
Show older comments
Hello,
I am trying to use findpeaks on a signal that has a specific frequency component. This signal is repiratory audio, and I am trying to separate the inhales vs the exhales. After obtaining the respiratory rate, I am trying to use findpeaks to isolate inhale vs exhale, but it does not always work properly. I was hoping someone here could help me refine this.
I calculate repspiratory rate using the FFT of the envelope of the signal. Then use findpeaks like below.
snip_lo = max(inverted_snip);
[v1, vv] = findpeaks(inverted_snip, "MinPeakDistance", Fs*((RespRate)/2), "MinPeakHeight", snip_lo *.85);
Whe it works out I can later isolate each valley to get a plot like this.

When it does not work out, the inhales and exhales get out of sync.

Each red plot should represent an exhale while the green represents an inhale, however, in the second image, the signal is too noisy in the center to decern between the peaks for the method I am using.
Any help would be very much appreciated.
Thank you.
0 Comments
Answers (1)
charan
on 19 Jun 2025
Hi,
Your approach does not seem to work whenever the spacing of breaths is inconsistent. In such cases using a fixed "MinPeakDistance" like "Fs*(RespRate)/2" might not capture both phases reliably. Here are some steps you can try out to fix this:
0 Comments
See Also
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!