Fast Fourier Transform (FFT)

 

Objective: Extract the PQRST wave of the heart's ECG from a complex noisy time-based signal obtained from a 3-lead differential input.

Answer: The Fast Fourier Transform and Digital Signal Processing

Hardware: Microcontroller with boot-loadable flash memory, a nifty algorithm written in C++ or other compatible language.

 

A simple example using MATLAB. Construct a noisy waveform and superimpose upon it three sinusoidal waveforms at 50, 120, and 300 hertz. The equation for this composite of sinusoidal waveforms is x = sin(2*pi*50*t) + sin(2*pi*120*t) + sin(2*pi*300*t).

 

The code entered into MATLAB to determine the hidden sinusoidal components buried in the noise floor would be:

 

t = 0:.001:.25;

x = sin(2*pi*50*t) + sin(2*pi*120*t) + sin(2*pi*300*t);

y = x + 2*randn(size(t));

plot(y(1:50))

title('Noisy time domain signal')

Y = fft(y,256);

Pyy = Y.*conj(Y)/256;

f = 1000/256*(0:127);

plot(f,Pyy(1:128))

title('Power spectral density')

xlabel('Frequency (Hz)')

 

Figure 1. Frequency spectra produced by MATLAB FFT algorithm.

 

Digital signal processors use FFT for a wide variety of applications. Perhaps one of the most interesting applications is to take the noisy complex waveform obtained from a 3-lead electrocardiogram of the heart and then applying an FFT algorithm to yield the PQRST wave of the heart's rhythm.

 

In its simplest form, the FFT is nothing more than a Fourier Transform conversion done from the time domain to the frequency domain. However, it is a computation done at a much higher speed than what a Continuous-Time Fourier Transform would require in computing time. This makes the FFT idea for microprocessor based instruments used to extract periodic waveforms, such as cardiac rhythms from a very noisy source. The noise source in the case of the ECG instrument is inherent broadband noise that exists on the ECG leads as picked up on the patient's body and the ambient electromagnetic energy field in the environment of the instrument.

 

If one was to construct a simple 3-lead ECG detector using 3 wire leads with adhesive and conductive electrodes and an oscilloscope, one would only see a huge mess of random noise on the scope's display. But the cardiac rhythm is there. It just a matter of extracting the periodic waveforms that comprise the true PQRST wave shape and discarding the noise. It is not simple enough to filter out the noise with solid state filters. The cardiac signal is a complex waveform of many Fourier frequency components in the same spectra band as the noise. Filtering the noise means the wanted signal is also filtered. Enter the Fast Fourier Transform. In the end, below is what is sought.

 

Figure 2. ECG printout, leads V1, II, and V5.

 

Figure 3. PQRST waves as seen in an electrocardiogram of a patient post-MI.

 

The Fourier transform X(f) of a continuous time function x(t) can be expressed as

 

 

The inverse transform is

 

 

The Discrete Fourier Transform is given by
 


where

where,

x(nT) is the discrete time signal in the time domain, and
X(mF) is the discrete frequency domain function that represents the time domain signal

 

 

A short discussion of about electrocardiograms: the action potential and heart contractions

 

ECG is an electrocardiogram. It provides one with a visual representation of the heart's electrical signals.
 
The heart beats because electrical impulses travel down along the surfaces of cardiac tissues (muscle fibers) that induces contractions in those muscle cells. The electrical impulse (action potential) does this by causing gated channels on cell surfaces to open up, thereby allowing potassium and sodium ions to pass through them to induce a disequilibrium in ion charge on both sides of the cell. When this happens, the electrical gradient across the cell membrane radically changes and allows an influx of chloride ions through chloride channels into the cell that activate myosin and actin. Those are proteins that create muscle action due to binding at the molecular level.
 
It also takes adenosine triphosphate (ATP, an energy molecule) to interact with myosin to cause it to deactivate, after contraction. Rigor mortis is when muscles go rigid because ATP is no longer produced in mitochondria upon death, from which they would normally originate in muscle cells to deactivate the strong attractive forces between actin and myosin that cause the contraction in the first place. The muscles therefore lock up upon death.
 
The cardiac contraction is due to the electrical impulse traveling from the top of the heart down through the axial length on the inside and to the apex, bottom of the heart, then back up along the exterior surface of the heart.
 
These series of electrical impulses constitute the ECG signal. Even though its the heart that is experiencing these electrical signals, those signals are strong enough to propagate to the outer surface of the skin where electrodes can pick them up on the thoracic (chest) cavity.
 
This is referred to as cardiac electrophysiology. A person can look at the shape of those electrical impulses to assess cardiac performance, extent of cardiac tissue scarring, presence of a heart attack, etc. The PQRST nomenclature refers to peaks in a single heart beat wave shape as shown in Figure 3. The shape of those peaks, or absence of one or more of them are critical clinical tools in assessing cardiac performance. For instance, an increase in the location of the ST part of the curve in the y-axis indicates a myocardial infarct (heart attack) has occurred. This is called "ST elevation" There are dozens of wave shapes on that single PQRST wave that can occur due to various cardiac problems.

 

 

 

Under Construction - more to come