Clear Filters
Clear Filters

Extracting individual breathing cycles from a signal and plotting the mean cycle

9 views (last 30 days)
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.
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'.

Answers (2)

Star Strider
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
Gail Distefano
Gail Distefano on 10 Mar 2022
Hi, I just wanted to say thanks very much for your reply and times taken to assist me. For a strange reason I did not get a notification so have only just seen this reply. It is extremely helpful. Thanks once again

Sign in to comment.


Cris LaPierre
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.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!