I want coding for feature extraction for ecg signal

3 次查看(过去 30 天)
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