Sie sind auf Seite 1von 10

OpenStax-CNX module: m49715 1

Discrete Fourier Transform


Techniques for Pulse Oximetry
Signal Processing *

Christopher Hood
This work is produced by OpenStax-CNX and licensed under the
„
Creative Commons Attribution License 4.0

Discrete Fourier Transform Techniques for Pulse Oximetry Signal Processing

1 Introduction

Pulse oximetry is the practice of measuring the amount of oxygen present in blood. Measuring the
amount of blood oxygen is important in critical surgical procedures, where it must be certain the patient is
not experiencing hypoxia. A common, non-invasive method of pulse oximetry involves passing light through
portions of esh (commonly a ngertip or earlobe) and processing the response. The desired quantity to be
measured is the percentage of oxygenated hemoglobin.

1.1 Pulse Oximetry

In this lab, sample data was measured by passing infrared and red light through a patient's ngertip and
measuring the intensity at the other side of the nger. The optical measurement of oxygenated blood is
made possible by the fact that oxygenated hemoglobin (HbO2 ) and deoxygenated hemoglobin (Hb) have
dierent absorption spectra. The goal of pulse oxymetry is to calculate the oxygen saturation SpO2 of one's
blood. This saturation is simply the ratio of oxygenated hemoglobin concentration co to total hemoglobin
concentration co + cd :
co
SpO2 = . (1)
co + cd

1.1.1 Beer-Lambert Law

When light passes through a material it loses energy as it is absorbed by matter. In the case of a given
aqueous solution, the material has associated with it an exinction coecient, , dependent on the wavelength
of light, which describes the light attenuation per unit distance per unit concentration. This brings us to
the law describing this attenuation, the Beer-Lambert law:

I = I0 e−c` , (2)

* Version 1.1: Apr 2, 2014 9:51 am -0500


„ http://creativecommons.org/licenses/by/4.0/

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 2

where I is the intensity of the light after passing a distance ` through the absorbing material, c is the
concentration of the absorbing solution, and I0 is the intensity of the source incident on the material.

1.1.2 Absorption of Hemoglobin

Hemoglobin exists in two dierence forms in human blood: oxygenated (HbO2 ) and deoxygenated (Hb).
Each has dierent extinction coeecients at dierent wavelengths. For the wavelengths of light used in this
lab, the values are as such:

r,o = 442 cm−1 M −1 red light (640 nm), HbO2 .


r,d = 4345.2 cm−1 M −1 red light (640 nm), Hb.
(3)
−1 −1
ir,o = 1214 cm M infrared light (940 nm), HbO2 .
ir,d = 693.44 cm−1 M −1 infrared light (940 nm), Hb.
The absorbance of red light through one's ngertip can be modeled by the following equation:

'
Ir (t) = Kr e−(r,o ∆co (t)+r,d ∆cd (t))` , (4)

where Kr is a constant that encompasses the source intensity of the light as well as the attenuation due
to static (non-changing) absorbance, such as skin and fat, as well as encompassing the attenuation due to
the average amount of hemoglobin present in the blood. The length `' is the eective distance of blood
containing the hemoglobin, while ∆co (t) and ∆cd (t) are the changes in concentration of oxygenated and
deoxygenated hemoglobin as a function of time with respect to their average values. One very important
notion to understand is the assumption that the ratio of oxygenated to total hemoglobin is constant over
short periods of time. It follows that a change in oxygenated hemoglobin will yield a proportional change in
dexoygenated hemoglobin. In other words, the oxygen saturation SpO2 can be calculated as

co ∆co (t)
SpO2 = = . (5)
co + cd ∆co (t) + ∆cd (t)
The absorbance of infrared light through one's ngertip, Iir (t), can be described similarly as

'
Iir (t) = Kir e−(ir,o ∆co (t)+ir,d ∆cd (t))` . (6)

An example of data of the measured intensity of red and infrared light passed through a nger is shown in
Figure 6. Note that the data have been shifted and scaled for better viewing to account for large dierences
in base LED intensity.

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 3

Figure 6: Sample of measured light intensity data.

1.1.3 Calculation of Oxygen Saturation

Ir (t) and Iir (t) are the only two signals that are measured in pulse oximetry. Note that in their descriptive
equations, Equs. (4) and (6), there is only one exponential function of time. Due to the relatively low
concentration of hemoglobin and small distance through which light passes, the time-changing portion of the
intensity signals is quite small. Because of this, it is appropriate to use the rst-order Taylor approximations
of these signals:

 
Ir (t) ≈ Kr 1 − (r,o ∆co (t) + r,d ∆cd (t)) `' ,
  (7)
Iir (t) ≈ Kir 1 − (ir,o ∆co (t) + ir,d ∆cd (t)) `' .
By ltering these signals, the dc (constant over short periods of time) and ac (average value of zero of short
periods of time) components may be extracted.

Ir,dc (t) = Kr ,
Ir,ac (t) = −Kr (r,o ∆co (t) + r,d ∆cd (t)) `' ,
(8)
Iir,dc (t) = Kir ,
Iir,ac (t) = −Kir (ir,o ∆co (t) + ir,d ∆cd (t)) `' .
Remember that ∆co (t) and ∆cd (t) have a mean value of zero.
Let the dc-normalized transmission ratio R be dened as as such:

Ir,ac (t) /Ir,dc (t) r,o ∆co (t) + r,d ∆cd (t)
R= = . (9)
Iir,ac (t) /Iir,dc (t) ir,o ∆co (t) + ir,d ∆cd (t)
Then, it can be shown with simple algebra that the oxygen saturation may be represented as

∆co (t) r,d − Rir,d


SpO2 = = . (10)
∆co (t) + ∆cd (t) R (ir,o − ir,d ) − (r,o − r,d )
Note that SpO2 is only a function of the dc-normalized transmission ratio R.

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 4

1.1.4 Calculating the Dc-normalized Transmission Ratio

The dc-normalized transmission ratio R essentially represents the ratio of the absorbance of blood per unit
length of red light to infrared light. This value is fairly constant over short periods of time. Note that
in Equ. (9)R is calculated as the the quotient of four dierent time-varying signals. In particular, Ir,ac (t)
and Iir,ac (t) are signals which have a mean value of zero. From a theoretical standpoint, since Ir,ac (t) and
Iir,ac (t) are supposed to be proportional to one another over short periods of time (several heart beats), the
points at which each signal crosses zero will still correspond of a quotient which has a limit of some nite
value. However, due to quantization error and random noise in the actual data measurement, such limit is
not guaranteed or even expected during actual processing. To avoid this division-by-zero, it is often better
to take Ir,ac (t) and Iir,ac (t) to be the overall amplitude of the ac signal over a short period of time.

1.1.4.1 Spectral Analysis

If the spectrum or a sampling of the spectrum of a short frame of signal is obtained, then the values of Ir,ac
and Iir,ac can be taken as the magnitude of the spectrum at the fundamental frequency of heartbeat. Then,
dividing by the respective dc levels (also obtained from the spectra) and taking the ratio yields the overall
dc-normalized transmission ratio for that time frame.

1.1.4.2 Instantaneous Amplitude

If linear time-invariant lters are used to obtain the signals Ir,ac (t), Iir,ac (t), Ir,dc (t), and Iir,dc (t), R can
again be calculated through a simple ratio.
By using a root-mean-square values of the ac signals to represent the instantaneous amplitudes of Ir,ac (t)
and Iir,ac (t), the average value for R can be calculated for short windows in time. Note that if a band-pass
lter is used to obtain the ac sequences, then this root-mean-square value is identical to taking the RMS of
the spectrum of the signal in the same band as the passband of the band-pass lter.

1.2 The Discrete Fourier Transform

The DFT, or discrete Fourier transform (often calculated using the the fast Fourier transform, or FFT)
is a transform which yields a sample of the spectrum (frequency domain representation) of a nite-length,
complex, and discrete sequence. The N -point DFT of signal x [n] is obtained by taking the scalar products
of vector x [n] with the complex sinusoids yk [n] = e−jωk n , where ωk are chosen such that (y0 , y1 , ..., yN −1 )
form an orthogonal basis for CN . These frequencies are given by

ωk = 2πk/N, k = 0, 1, ..., N − 1. (11)

Thus, the DFT of x [n] at frequency ωk is given by

N
X −1
X [k] = x [n] e−j(2πk/N )n , k = 0, 1, ..., N − 1. (12)
n=0

Note that the ωk for k > N/2 correspond to the negative frequencies of x [n]. See Table 1 for some example
values of ωk for odd and even values of N . ωk' is the value of ωk shifted so that it falls in the range (−π, π]
(recall that digital frequency is periodic with period 2π ).

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 5

N=4 N=5
'
k ωk ωk ∈ (−π, π] k ωk ωk' ∈ (−π, π]
0 0 0 0 0 0

1 π/2 π/2 1 2π/5 2π/5


2 π π 2 4π/5 4π/5
3 3π/2 −π/2 3 6π/5 −4π/5
4 8π/5 −2π/5

Table 1: Example values of ωk for k = 0, 1, ..., N − 1

In DFT practice, each value of X [k] is known as the frequency bin for ωk . Note that the frequency step
of the DFT, or dierence in frequency between adjacent bins, is constant.
Ask Yourself: If a continuous-time signal is sampled at 40 samples/second and X [k] is the 1000-point
DFT of that sequence, for what values of ωk (between −π and π) does X [k] exist? To what values of the
continuous-time frequency fk do ωk correspond?
Ask Yourself: If x [n] is real, what can be said about X [k] for values of ωk ∈ [0, π] compared to X [k]
for values of ωk ∈ (−π, 0)?

1.2.1 Window Functions

The N -point DFT of the nite-length sequence x [n] is a sampling of the discrete-time Fourier transform
(DTFT) of x [n]. If the values of these samples are treated as being the areas under 2π/N -shifted impulses in
ω describing the whole spectrum (i.e. as Fourier series coecients), they describe an innite-length sequence
of period N. This periodic sequence, x̃ [n], is such that every period of x̃ [n] is a shifted x [n]. In other words,

x̃ [n] = x [n − kN ] , k ∈ Z, n = kN, kN + 1, ..., (k + 1) N − 1. (13)

In short, the DFT computation essentially assumes x [n] is periodic with period N, then computes a DTFT
of that periodic signal. It follows that if x [n] is a nite-length frame sampled from some longer continuous
signal x (t) which isn't periodic with analog period N/fs , then computing the DFT of x [n] will indicate the
presence of frequency components which don't actually compose x (t).
In order to reduce the magnitude of these extraneous frequency components in the DFT, it is helpful
to reduce the eect of any discontinutities between x [0] and x [N − 1] by multiplying x [n] by a window
function. A window function is any discrete and bounded function of length N. An eective window
function is symmetric and has a value of 1 near the middle and a value that is small near the ends. The
window function used in this lab is called the Hamming window. It was designed such that the magnitude
of the frequency response at the nearest side-lobe is minimized. A plot of an example Hamming window
is shown in Figure 13. Notice the suppressed nearest sidelobes in the DTFT of the Hamming window in
Figure 13 compared to the rectangular window.

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 6

(a)

(b)

Figure 13: A Hamming window of length 32.

2 Warm-up

2.1 DFT Techniques

1. Create a sinusoid xx of length L=16, digital frequency w0=pi/2, amplitude 1, and dc oset 10.
2. Compute the N-point DFT, XX, of xx using the Matlab function fft(), using N=L.
3. Plot (using stem()) the magnitude of XX versus digital frequency for values of frequency between -pi
and pi. (Hint: The values of XX(nn) for nn=1:N correspond to frequencies ww=2*pi*(nn-1)/N. Now
nd for which values of nn is ww greater than pi, then translate these values of ww to their negative
equivalents.)
4. Verify that a peak in the spectrum occurs at w0. What is the value of this peak? What is the value of
XX(1) (this corresponds to X [0], the dc level)? Do the relative values at those frequencies correspond
to the amplitude and dc oset of xx? How do their absolute values relate to the signal length N?
5. Repeat steps 1-4, instead with a new sinusoid xx1 of frequency w1=1.75 and DFT XX1. Why is the
plot of XX1 not simply a translated version of the plot of XX? What is the value of the peak in the
spectrum (besides at dc)? What are the values of the DFT at points adjacent to the peak?
6. Repeat steps 1-5, now using a signal length L=1024. How did the plot in step 5 improve?

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 7

7. Repeat steps 1-5, using a signal length L=16 and a DFT length N=1024, so that the input is zero-padded.
How did the plots in steps 4 and 5 change?

Ask Yourself: If 1 second of a continuous-time signal is sampled at fs = 8000 Hz, what is the frequency
step (i.e. resolution) ∆ωk = ωi − ωi−1 and corresponding continuous frequency resolution ∆fk ? Increase the
sampling frequency to 16000 Hz. What is the value for ∆ωk now? For ∆fk ? How can ∆fk be increased?

2.2 DFT Windowing

1. Create a sinusoid xx of length L=128, digital frequency w0=1.5, amplitude 1, and dc oset 0.
2. Compute the N-point DFT, XX1, N=L, of xx using the Matlab function fft().
3. Compute the windowed DFT, XX2, of xx by multiplying xx by a Hamming window of length L
(hamming()) before computing the DFT.
4. Plot the magnitude of XX1 and XX2 versus digital frequency on the same plot.
5. Compare the values of XX1 and XX2 for the values of ww around ±1.5.
6. Repeat steps 1-5, instead using L=128 and a DFT-length N=1024. Compute a new DFT, XX3, by
pre-padding xx with zeros, multiplying by a Hamming window of length N, then computing its N-point
DFT. Why is the plot of XX3 dierent than XX2?

Ask Yourself: If the N -point DFT is being computed of a frame of a signal that is known to be periodic
with period N, would it be benecial to multiply that signal by a window function? Is this a real issue when
dealing with discrete signals sampled from actual continuous time signals?

3 Laboratory Exercise

The DFT will be used to determine the dc-normalized ratio of red light intensity to infrared light intensity
transmitted through esh.

3.1 Frequency Domain Analysis and Computation

In this method, the pulse oximeter ratio will be calculated by taking the ratio of DFT bins calculated from
various moving frames of the input signals. A diagram for the general method of this calculation is shown
in Figure 13.

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 8

Figure 13: Diagram for calculation of transmission ratio R. Note that same DFT/mask process used
for infrared signal.

3.1.1 Preparing to Compute DFT


1
Download the pulse oximetry Matlab data le. [Media Object]

1. Load the Matlab signals in pulseOxData.mat. I_red is the signal that corresponds porportionally
to the intensity of red light passing through esh (Ired(t)), and I_ir to infrared light (Iir (t)). fs is
the sampling frequency. The signals are of approximately 120 seconds in length.
2. Determine the frequency band between fl and fu in which the heart pulse signal is expected to lie.
Note that normal human heart rates range from 45 beats-per-minute (rest) to 240 BPM (stress).
3. A constant-length moving frame of signal input will be used to compute many DFTs at dierent starting
points in time. From the knowledge of the signal band of interest, determine a target frame length in
seconds so that each frame encompasses several periods of heartbeat. Determine the length in samples.

4. Use the Matlab function nextpow2() to determine a frame length N in samples which is a power
of 2 and close to the target length from the previous step. A frame length of some power of 2 is
desireable because the FFT algorithm used to compute the DFT works much faster with sequences of
those lengths.

Ask Yourself: Why, in this method, is it important to reduce the DFT computation time?

1. To increase the number of ratio points calculated, the frame iterations can be overlapped. It is recom-
mended to overlap each frame by 50%. Determine the number of samples by which the starting index
of the frame must increase per iteration.
1 This media object is a downloadable le. Please view or download it at
<https://legacy.cnx.org/content/m49715/1.1/pulseOxData.mat>

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 9

2. Calculate the DFT bin frequency step and a vector ff of continuous-time frequencies that will corre-
spond to a DFT of length N.
3. Calculate the indices for the ff vector which correspond to the band-limited fl and fu values previously
determined. Use the floor() and ceil() functions to set the indices accordingly.

3.1.2 Iterating the DFT

Now, a program loop can be constructed to step the input frame and take the ratio of DFT bin values to
nd the ratio R.

1. In the constructed loop, mask o the input signals I_red and I_ir to the correct size and position in
the iteration and compute their windowed DFTs, utilizing the Hamming window. Use the secondary
argument of N in the DFT to indicate to the function to pad the input with zeros at the end if the
frame is not of length N (occurs at the very last iteration). The input to the fft() function should
be the product of the input frame and a Hamming window of length N to minimize the magnitude of
sidelobes in the DFT frequency response.
2. Find the maximum of the absolute value of the DFT of each input frame within the range of the
frequency indices previously computed. Record these values as redAC and irAC. Also record values for
redDC and irDC Aside: since we are interested in the signal amplitude
as the rst bin of their DFTs. (
in some band, it might behoove us to take the square-root of the total energy in that band, i.e. take the
norm of all DFT points in that band and use that quantity as the ac value. You can try the calculation
using the max and the norm and see if the end result does not dier.)
3. Compute the dc-normalized transmission ratio for the particular iteration as in Equ. (9). The ratio for
each iteration should be recorded in a vector so that the ratio may be plotted as a function of time.

After the ratio for each frame has been calculated, the oxygen saturation can be computed as in Equ. (10).
Plot the saturation as a function of time. Is the saturation at a healthy level (95-100%)?
Re-run this method using a frame overlap of N −1 instead of N/2, so that each frame only increases
position by one sample for each iteration. Plot the SpO2 on the same plot and time-scale as the SpO2
value for N/2 overlap. How close are they? Why might such a large overlap be a poor choice in a real-time
scenario?

3.2 Alternative Method of Pulse Oximeter Analysis

The fact that the desired ac values of Ired and Iir are proportional to the square-roots of the spectral energy
in the heart-beat band motivates the use of a simple bandpass lter followed by a root-mean-square (RMS)
calculation in order to calculate the dc-normalized transmission ratio. This method is useful for non-real-
time analysis of a pulse ox signal, especially for plotting a smooth graphical representation of the oxygen
saturation value as a function of time.
In order to nd Ired,dc and Iir,dc , the pulse ox signals will be ltered with a low-pass lter to obtain a
signal that is constant over short intervals. To nd Ired,ac and Iir,ac , a band-pass lter is used followed by
an RMS calculation.

3.2.1 Filtering the signals

1. Determine the lter coecients for a Chebyshev lter (see help cheby1) that isolates the ac portion
of the input signals. Use the fl and fu frequencies previously used as the cuto frequencies for this
lter. Note that the red-light and infrared-light input signals uctuate at the same frequency, and
since the ratio of their amplitudes is what matters, pass-band ripple is acceptable.
2. Determine the lter coecients for a Chebyshev lter that isolates the dc portion of the input signals.
Choose the order of the lter such that the magnitude of the lter frequency response at dc is 1.

http://cnx.org/content/m49715/1.1/
OpenStax-CNX module: m49715 10

3. Using the filter() function, compute red_ac and ir_ac, the ac components of the input, and red_dc
and ir_dc, the dc components of the input. It may be necessary to pre-pad the signals with a constant
value in order to throw-away any ringing at the beginning of the output.
4. Plot on the same graph the sum of the isolated dc and ac components of each input signal and their
corresponding original input signal.

3.2.2 Computing the Ac RMS Level

1. Square the I_red and I_ir signals to obtain their instantaneous energies.
2. Filter the squared signals with the low-pass lter used to nd the dc signal in order to nd the mean-
squared signal, then take the square-root of the resulting sequence.

The dc-normalized transmission ratio can be calculated by Equ. (9), performing element-wise division be-
tween the ac magnitude sequences and the low-frequency dc sequences. Then, the oxygen saturation can
be computed as in Equ. (10). Plot the saturation as a function of time. Compare this plot to the plot
obtained using iterated DFTs with an N −1 sample overlap. Explain any dierences between the plots.

http://cnx.org/content/m49715/1.1/