How do I Identify the intervals between heart sound S1 and heart sound S2? :/
2 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150146/image.jpeg)
In the picture, I need to find the intervals/position of red marked and orange marked using MATLAB. Kindly help me. :(
3 个评论
Image Analyst
2013-9-29
In the future, it would help people help you if you attached an m-file that generated your signal.
Walter Roberson
2013-9-29
The values between the marks are not 0, but they are within a certain tolerance of 0, are they not? abs() of the signal is less than some constant? If you look at my line of code
hassilence = [false, (abs(YourSignal) < NoiseTolerance), false];
notice that it is not testing for 0 but rather that it is within some fixed bounds for the silence. To guard against the possibility that the signal might be near that value as it crosses between negative and positive, my code requires a number of consecutive points within those bounds; the number of consecutive points needed is controlled by my variable "min_interval_size".
回答(1 个)
Walter Roberson
2013-9-29
hassilence = [false, (abs(YourSignal) < NoiseTolerance), false];
min_interval_size = 5; %adjust as needed
intervals_begin = strfind([false true(1,min_interval_size)], hassilence);
intervals_end = strfind([true(1,min_interval_size), false], hassilence);
Now, if intervals_begin(1) is 1, then the signal started with silence, and the first non-silence is at position (intervals_end(1) + min_interval_size - 1); each silence interval starts at (intervals_begin(K)) and ends at (intervals_end(K) + min_interval_size - 1). If the two vectors intervals_begin and intervals_end are not the same length then the signal ends with silence with signal position (intervals_begin(end)) not indicating anything useful.
If intervals_begin(1) is not 1, then the signal starts with noise, and I leave it to you to figure out the correspondences between the pairs. Just keep in mind that the position found in intervals_begin(K) will exactly match the location of the beginning of silence in the signal, but the positions found in intervals_end(K) need to be adjusted to find the corresponding location in the signal array.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 ECG / EKG 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!