File Exchange Pick of the Week

Our best user submissions

Simulink Model for Fetal ECG Extraction

Will's picks this week is Simulink model for Fetal ECG extraction by Igal.

Signal processing isn't typically an area of interest for me. Half the time, all that filtering, modulation, buffering, and quantization is black magic to me. But I find Igal's File Exchange contribution is oddly approachable and understandable, most likely because of the quality design of the model.

Igal has leveraged a MATLAB example created by Dr. Scott C. Douglas to construct a Simulink model to identify the heart rate of a fetus based on sensor data from two electrodes. Effectively, you have two primary signals (mother and baby's heartbeat) with noise superimposed. The goal is to filter out everything but the baby's heartbeat and calculate the period of the signal based on our estimation of that heartbeat.

In order to accomplish this, Igal relies on blocks from the Simulink and Digital Signal Processing libraries. But he also makes use of his own custom components via the MATLAB Function block. Here is a screenshot of the primary subsystem of the Simulink model. I made some aesthetic changes so that it would fit within the blog's width restrictions.
Igal's Fetal ECG Processing Algorithm

Now this is all well and good, but one of the beautiful things about Simulink (and MATLAB for that matter) is the ability to convert your work into another computing language. In this case, Igal has ensured that his model is suitable for conversion into Verilog HDL code. This enables us to take our work and run it on an FPGA (if we happen to have one laying around). And in order to get the biggest bang for your buck on such hardware, you'll need to dabble with fixed point math. Luckily for us, Igal's signals are already set to fixed point in the model.

You can right-click on the primary subsystem and select "Generate HDL for Subsystem" if you have HDL Coder. I did as much; here's a small sample of the resultant code.
Igal's Fetal ECG Verilog Code

Comments Let us know what you think here or leave a comment for Igal.
|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.