File Exchange

## Simulink model for Fetal ECG extraction (HDL Compatible algorithm)

version 1.0.0.0 (26 KB) by
This is an HDL Coder compatible Fetal ECG extraction algorithm.

Updated 26 Feb 2012

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This is an HDL Coder compatible Fetal ECG extraction algorithm. The Simulink model follows the floating point MATLAB algorithm with some changes forced by the HDL Coder compatibility.

The "blue" subsystem is HDL Coder compatible.

* Note: this is only a demonstration of tools' capabilities and not a commercial grade algorithm!

### Cite As

Igal (2020). Simulink model for Fetal ECG extraction (HDL Compatible algorithm) (https://www.mathworks.com/matlabcentral/fileexchange/35328-simulink-model-for-fetal-ecg-extraction-hdl-compatible-algorithm), MATLAB Central File Exchange. Retrieved .

nitin mane

%ECG Function file

function x = ecg(L)
a0 = [0, 1, 40, 1, 0, -34, 118, -99, 0, 2, 21, 2, 0, 0, 0];
d0 = [0, 27, 59, 91, 131, 141, 163, 185, 195, 275, 307, 339, 357, 390, 440];
a = a0 / max(a0);
d = round(d0 * L / d0(15));
d(15) = L;
for i = 1:14
m = d(i) : d(i+1) - 1;
slope = (a(i+1) - a(i)) / (d(i+1) - d(i));
x(m+1) = a(i) + slope * (m - d(i));
end

end

Md Fazlul Karim

Hello, I can't run the proyect, "Undefined function 'ecg' for input arguments of type 'double'". Can you help me? Thanks.
PD: The code is amazing

Shrishail Ganiger

what is Hd means in the code??

Xin Gao

Great job!
PS: Dear Dr. Igal Sebag, I'd like to use this code for modifications, doing experiments and then contribute to a book chapter, may I know which publication from you should I cite? THanks very much!

Best regards,

Xin

Benjamin

##### MATLAB Release Compatibility
Created with R2011a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux