HEART RATE from heart sound

8 次查看(过去 30 天)
Monday David
Monday David 2024-2-28
Hi, Please I need help to remove errors on peak detected, here is the code I used.
  2 个评论
Cris LaPierre
Cris LaPierre 2024-2-28
Try using the Find Local Extrema task in a live script. This will allow you to interactively adjust the inputs to findpeaks, which can make it easier to identify the correct settings.
Monday David
Monday David 2024-2-29
移动:Star Strider 2024-2-29
Here is my audio file.
Kindly assist on it.
Thanks

请先登录,再进行评论。

回答(1 个)

William Rose
William Rose 2024-2-28
编辑:William Rose 2024-2-29
@Monday David, If you attach the MP3 file, others can run your code. You will have to zip it first.
[Edit: The sounds which are labelled S1 in the plot below are really S2, and vice versa. This does not affect the accuracy of the estimate of heart rate.]
I would rectify the signal with abs() instead of setting negaitve values to zero. But it probably won't make a huge difference. I wonder what Fs is, because if I knew, I would undertand the plot in the image better. I cannot tell how many seconds of data I am looking at.
The plot in your image has peaks with irregular spaciong and amplitude. It certainly does not look like normal heart sounds.
Here is a 10 second recording of normal heart sounds, from the University of Michigan heart sounds library.
unzip('heartSoundsApexNormalBell10s.zip');
[x,Fs]=audioread('heartSoundsApexNormalBell10s.mp3');
t=(0:length(x)-1)'/Fs; % time vector
envDur=0.02; % envelope duration (s)
[xUpper,~]=envelope(abs(x),envDur*Fs,'rms');
[pks,locs]=findpeaks(xUpper,Fs,MinPeakDistance=0.3,MinPeakHeight=0.1);
s1pks=pks(pks>0.4); s1locs=locs(pks>0.4);
s2pks=pks(pks<=0.4); s2locs=locs(pks<=0.4);
plot(t,xUpper,'-b',s1locs,s1pks,'r*',s2locs,s2pks,'gx');
grid on; xlabel('Time (s)'); legend('amplitude','S1','S2','Location','southeast')
Estimate the HR from the S1 locations:
HR=(length(s1locs)-1)/(s1locs(end)-s1locs(1));
fprintf('Heart rate=%.1f bpm.\n',HR*60)
Heart rate=74.7 bpm.
OK
  11 个评论
William Rose
William Rose 2024-3-4
@Monday David, you're welcome. Good luck with your HR analysis.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Measurements and Spatial Audio 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by