Extracting individual breathing cycles from a signal and plotting the mean cycle
11 views (last 30 days)
Show older comments
I have a breathing trace, which I have smoothed and use FindPeaks to identify the peaks. How do I extract the individual beathing cyles between the peaks so that I can plot these over each other and calculate the mean breathing cycle?
I know there is a baseline shift so I also need to look at detrending the data first.
I would be very grateful for any input or direction to where I might find information on how to do this.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/905715/image.png)
I have tried to extract the first 3 regions of interest but an 'unrecognized function error'.
roilims = [0 227; 227 480; 480 745];
>> sigroi = extractsigroi(dt_B,roilims);
Unrecognized function or variable 'extractsigroi'.
0 Comments
Answers (2)
Star Strider
on 24 Feb 2022
If the peaks define the cycle, then finding the ‘valleys’ between them will define the beginning and end points of each cycle. I would use either findpeaks with the negative of the signal (turning the ‘valleys’ into peaks) or the islocalmin function.
An example of that to create an ensemble average (not necessary, use only the parts of the code that apply to your problem) is Combining repetitive curves into one average curve and specifically this Comment.
.
11 Comments
Star Strider
on 10 Mar 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Cris LaPierre
on 24 Feb 2022
extractsigroi is part of the Signal Processing Toolbox. It would appear you do not have it installed. If you have access to it through your license, you can add it using the Add-Ons explorer.
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!