I want coding for feature extraction for ecg signal

조회 수: 7 (최근 30일)
Saranya Riya
Saranya Riya 2017년 3월 9일
답변: Hari 2025년 5월 28일
Need code for feature extraction for ecg signal.

답변 (1개)

Hari
Hari 2025년 5월 28일
Hi Saranya,
I understand that you want to perform feature extraction on an ECG signal. Feature extraction in ECG signals typically involves identifying key points such as R-peaks, QRS complexes, and other waveform characteristics.
I assume you have an ECG signal already loaded in MATLAB and you want to extract features like R-peaks and QRS duration.
In order to perform feature extraction on an ECG signal, you can follow the below steps:
Load and Pre-process the ECG Signal:
Ensure your ECG signal is loaded and pre-processed for noise reduction, if necessary.
% Assuming 'ecgSignal' is your ECG data and 'fs' is the sampling frequency
ecgSignal = load('your_ecg_data.mat'); % Load your ECG data
fs = 1000; % Example sampling frequency in Hz
Detect R-peaks:
Use the “findpeaks” function to detect R-peaks in the ECG signal.
[~, rPeaks] = findpeaks(ecgSignal, 'MinPeakHeight', 0.5, 'MinPeakDistance', 0.6*fs);
Extract QRS Complex:
Define a window around each R-peak to extract the QRS complex.
qrsWidth = round(0.1 * fs); % QRS width in samples
qrsComplexes = arrayfun(@(r) ecgSignal(max(1, r-qrsWidth):min(length(ecgSignal), r+qrsWidth)), rPeaks, 'UniformOutput', false);
Calculate Features:
Compute features such as QRS duration and R-R intervals.
qrsDurations = cellfun(@length, qrsComplexes) / fs; % QRS duration in seconds
rrIntervals = diff(rPeaks) / fs; % R-R intervals in seconds
Output the Extracted Features:
Display or save the extracted features for further analysis.
fprintf('Average QRS Duration: %.2f seconds\n', mean(qrsDurations));
fprintf('Average R-R Interval: %.2f seconds\n', mean(rrIntervals));
Refer to the documentation of “findpeaks” function to know more about its usage:
Hope this help

카테고리

Help CenterFile Exchange에서 ECG / EKG에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by