“MATLAB, MATLAB Coder, and Fixed-Point Designer enabled our small team to develop a complex real-time signal processing algorithm, optimize it to reduce power and memory requirements, accelerate embedded code implementation, and perform the rigorous testing required for medical device validation.”Marina Brockway, VivaQuant
Each year, more than 4 million patients experience dizziness, fainting, or discomfort from a pounding or racing heartbeat. Their doctors give many of these patients a small wearable device that continuously monitors their heart rhythm via electrocardiogram (ECG) for up to a month while they go about their normal activities. In contrast to ECG recordings obtained in the hospital or doctor’s office, these ambulatory ECGs are often corrupted by episodes of noise and can be difficult or impossible to analyze. The noise can cause false positive and false negative event detections that increase the time and cost of analysis and can result in delayed or missed diagnosis of heart rhythm abnormalities.
Engineers at VivaQuant, with support from the National Heart, Lung, and Blood Institute, are developing a heart rhythm monitoring device that will employ Multi-Domain Signal Processing™ (MDSP) to suppress in-band noise by up to 26 dB without distorting the ECG waveform. This device, with algorithms designed with MATLAB® and implemented on an embedded processor with MATLAB Coder™, enables accurate detection of cardiac arrhythmias from noisy ECGs. “I’ve used MATLAB for many years to develop complex signal processing, control, and informatics algorithms,” says Marina Brockway, founder and chief technology officer of VivaQuant. “With MATLAB Coder and Fixed-Point Designer, I can go from idea to product faster than I ever thought possible.”
Simple infinite impulse response (IIR) filters can reduce noise outside the ECG passband, but they cannot remove noise inside the passband without distorting the signal. To achieve this goal, VivaQuant needed to develop an algorithm that performs complex computations on large matrices and then implement it on a device small enough to be worn comfortably for weeks without having to change the battery. The full system, including the microprocessor and front-end electronics, needed to acquire and process a two-vector ECG in real time while consuming less than one milliamp of current.
VivaQuant sought to improve upon the traditional design approach whereby algorithms are developed by one team and then handed off to a separate team of programmers for implementation. “When algorithm developers throw a design over the fence to a different team, much is often lost in communication,” says Brockway. “We needed to do this with a small team without compromising performance or quality.”
VivaQuant used MATLAB and MATLAB Coder to accelerate development.
Brockway and her colleagues used MATLAB and Signal Processing Toolbox™ to develop the floating-point version of the algorithm, which employed matrix operations, statistical tests, digital filters, and signal detection and estimation.
They validated the algorithm by testing it on ECG data that included both clean and noisy versions of the same ECG signals. They added various noises to known clean ECG signals and then applied the algorithms to verify that the noise had been reduced and that the original ECG signal characteristics had not been distorted.
Using Fixed-Point Designer™, they converted the floating-point algorithm to fixed point. They instrumented the algorithm code to log minimum and maximum variable values, and used this information to optimize fixed-point data types for accuracy within tight processor constraints.
To maintain equivalence between the floating-point and fixed-point versions, they verified the fixed-point implementation after each optimization step. The team developed a MATLAB test platform that automatically ran the fixed-point and floating-point versions against test data and performed a statistical comparison of the results.
The team accelerated testing by generating C code for individual algorithm modules with MATLAB Coder. They also created executable MATLAB files to invoke the C code during test runs.
They generated C code for the complete algorithm, deployed it to an ARM® Cortex®-M series processor, and performed further optimization and testing.
Having completed a prototype demonstrating the feasibility of implementing its MDSP algorithm on an ARM Cortex processor within the necessary power constraints, VivaQuant is now entering formal development and testing.
Development accelerated by 300%. “With MATLAB and MATLAB Coder we implemented the algorithm in just six months—without having to engage a separate programming team,” says Brockway. “I estimate that our process is three to four times more efficient than the traditional approach, enabling us to quickly deploy highly complex algorithms in real-time embedded systems to improve patients’ lives.”
Power and memory consumption minimized. “Our target battery life was three weeks in a 15 cc package,” says Brockway. “Fixed-Point Designer was instrumental in enabling us to optimize the algorithm and exceed this target. The device weighs less than 15 grams and, unlike many current devices, will be comfortable to wear.”
Rigorous testing enabled. “For a medical device, quality, reliability, and safety are paramount,” notes Brockway. “The test platform we built with MATLAB enabled us to conduct rigorous tests at every stage of development and automatically identify any discrepancies in the results.”