Generate K randomly rearranged ECG signals from the extracted beats, where K can be any large integer.

6 views (last 30 days)
ECG Signal Information from "data_116_N_V_R.mat":
load data_116_N_V_R.mat
openfig(illustration.fig)
whos -file data_116_N_V_R.mat
Name Size Bytes Class Attributes ECGsignal 649783x1 5198264 double RRinterval 2410x1 19280 double Rpeak 2411x1 19288 double annotation - 2779 categorical
- ECGsignal: MITDB ECG signal sampled at 360 Hz.
- Rpeak: Locations of R-peaks in the ECG signal, provided as sample indices.
- RRinterval: Intervals in samples between consecutive R-peaks based on the Rpeak array.
- annotation: Beat-type annotation centered around each R-peak. In this test data, each beat is labeled as either "N" or "V," but it can represent various other types.
Beat Definition:
Please, refer to the attached figure (illustration.fig).
openfig('illustration.fig');
Each beat is defined by two portions extending around a central R-peak:
- Left portion: 40% of the preceding RR interval, to the left of the R-peak.
- Right portion: 60% of the succeeding RR interval, to the right of the R-peak.
I want to segment every beat and then randomly rearrange segmented beats to form new ECG signals.
Discontinuity Adjustment for Rearranged Beats:
Due to the random reordering, there will be discontinuities between consecutive beats. To minimize these:
- Adjust the first sample of each right-side beat by +1 or -1 relative to the last sample of the preceding left-side beat.
- +1 adjustment if the second sample of the right-side beat is greater than the first, then shift the rest smaples of the beat accordingly.
- -1 adjustment if the second sample of the right-side beat is smaller than the first, then shift the rest smaples of the beat accordingly.
Goal:
- Generate K randomly rearranged ECG signals from the extracted beats, where K can be any large integer (let's say e.g., 10).
- I want to have updated RR-intervals (RRinterval), R-peaks (Rpeak), and annotations in accordance with newly generated ECG signals.
  7 Comments

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 17 Oct 2024
Because each segment may be a different number of samples (elements) you will have to first go through the signal and store the individual segments in a cell array, say it's called allBeats.
Then you can shuffle the order
randomOrder = randperm(numel(allBeats))
allBeats = allBeats(randomOrder);
Then you can concatenate all the cells together into a single double array.
allBeats = {[1,222,3], [40,55,66,77]} % Sample data with y-values of 2 beats
allBeats = 1x2 cell array
{[1 222 3]} {[40 55 66 77]}
signal = cell2mat(allBeats) % Create single vector signal.
signal = 1×7
1 222 3 40 55 66 77
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

Categories

Find more on Measurements and Feature Extraction in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!