Findpeaks based on signal frequency

4 次查看(过去 30 天)
Kcire L
Kcire L 2022-10-26
回答: charan 2025-6-19
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.

回答(1 个)

charan
charan 2025-6-19
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:

类别

Help CenterFile Exchange 中查找有关 Spectral Estimation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by