Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Biosignal and Biomedical Image Processing MATLAB based Applications - John L. Semmlow

.pdf
Скачиваний:
404
Добавлен:
10.08.2013
Размер:
4.43 Mб
Скачать

TABLE 1.2 Sources of Variability

Source

Cause

Potential Remedy

 

 

 

Physiological

Measurement only indi-

Modify overall approach

variability

rectly related to variable

 

 

of interest

 

Environmental

Other sources of similar

Noise cancellation

(internal or external)

energy form

Transducer design

Artifact

Transducer responds to

Transducer design

 

other energy sources

 

Electronic

Thermal or shot noise

Transducer or electronic

 

 

design

 

 

 

variability or noise. This demonstrates the important role of the transducer in the overall performance of the instrumentation system.

Electronic Noise

Johnson or thermal noise is produced by resistance sources, and the amount of noise generated is related to the resistance and to the temperature:

VJ =

4kT R B

volts

(2)

where R is the resistance in ohms, T the temperature in degrees Kelvin, and k is Boltzman’s constant (k = 1.38 × 10−23 J/°K).* B is the bandwidth, or range of frequencies, that is allowed to pass through the measurement system. The system bandwidth is determined by the filter characteristics in the system, usually the analog filtering in the system (see the next section).

If noise current is of interest, the equation for Johnson noise current can be obtained from Eq. (2) in conjunction with Ohm’s law:

IJ =

 

amps

 

4kT B/R

(3)

Since Johnson noise is spread evenly over all frequencies (at least in theory), it is not possible to calculate a noise voltage or current without specifying B, the frequency range. Since the bandwidth is not always known in advance, it is common to describe a relative noise; specifically, the noise that would occur if the bandwidth were 1.0 Hz. Such relative noise specification can be identified by the unusual units required: volts/√Hz or amps/√Hz.

*A temperature of 310 °K is often used as room temperature, in which case 4kT = 1.7 × 10−20 J.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

Shot noise is defined as a current noise and is proportional to the baseline current through a semiconductor junction:

Is =

 

amps

 

2q Id B

(4)

where q is the charge on an electron (1.662 × 10−19 coulomb), and Id is the baseline semiconductor current. In photodetectors, the baseline current that generates shot noise is termed the dark current, hence, the symbol Id in Eq. (4). Again, since the noise is spread across all frequencies, the bandwidth, BW, must be specified to obtain a specific value, or a relative noise can be specified in amps/√Hz.

When multiple noise sources are present, as is often the case, their voltage or current contributions to the total noise add as the square root of the sum of the squares, assuming that the individual noise sources are independent. For voltages:

VT = (V21 + V22 + V23 + + V2N)1/2

(5)

A similar equation applies to current. Noise properties are discussed further in Chapter 2.

Signal-to-Noise Ratio

Most waveforms consist of signal plus noise mixed together. As noted previously, signal and noise are relative terms, relative to the task at hand: the signal is that portion of the waveform of interest while the noise is everything else. Often the goal of signal processing is to separate out signal from noise, to identify the presence of a signal buried in noise, or to detect features of a signal buried in noise.

The relative amount of signal and noise present in a waveform is usually quantified by the signal-to-noise ratio, SNR. As the name implies, this is simply the ratio of signal to noise, both measured in RMS (root-mean-squared) amplitude. The SNR is often expressed in "db" (short for decibels) where:

SNR = 20 log

Signal

 

(6)

Noise

To convert from db scale to a linear scale:

SNRlinear = 10db/20

(7)

For example, a ratio of 20 db means that the RMS value of the signal was 10 times the RMS value of the noise (1020/20 = 10), +3 db indicates a ratio of 1.414 (103/20 = 1.414), 0 db means the signal and noise are equal in RMS value,

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

−3 db means that the ratio is 1/1.414, and −20 db means the signal is 1/10 of the noise in RMS units. Figure 1.6 shows a sinusoidal signal with various amounts of white noise. Note that is it is difficult to detect presence of the signal visually when the SNR is −3 db, and impossible when the SNR is −10 db. The ability to detect signals with low SNR is the goal and motivation for many of the signal processing tools described in this text.

ANALOG FILTERS: FILTER BASICS

The analog signal processing circuitry shown in Figure 1.1 will usually contain some filtering, both to remove noise and appropriately condition the signal for

FIGURE 1.6 A 30 Hz sine wave with varying amounts of added noise. The sine wave is barely discernable when the SNR is −3db and not visible when the SNR is −10 db.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

analog-to-digital conversion (ADC). It is this filtering that usually establishes the bandwidth of the system for noise calculations [the bandwidth used in Eqs.

(2)–(4)]. As shown later, accurate conversion of the analog signal to digital format requires that the signal contain frequencies no greater than 12 the sampling frequency. This rule applies to the analog waveform as a whole, not just the signal of interest. Since all transducers and electronics produce some noise and since this noise contains a wide range of frequencies, analog lowpass filtering is usually essential to limit the bandwidth of the waveform to be converted. Waveform bandwidth and its impact on ADC will be discussed further in Chap- ter 2. Filters are defined by several properties: filter type, bandwidth, and attenuation characteristics. The last can be divided into initial and final characteristics. Each of these properties is described and discussed in the next section.

Filter Types

Analog filters are electronic devices that remove selected frequencies. Filters are usually termed according to the range of frequencies they do not suppress. Thus, lowpass filters allow low frequencies to pass with minimum attenuation while higher frequencies are attenuated. Conversely, highpass filters pass high frequencies, but attenuate low frequencies. Bandpass filters reject frequencies above and below a passband region. An exception to this terminology is the bandstop filter, which passes frequencies on either side of a range of attenuated frequencies.

Within each class, filters are also defined by the frequency ranges that they pass, termed the filter bandwidth, and the sharpness with which they increase (or decrease) attenuation as frequency varies. Spectral sharpness is specified in two ways: as an initial sharpness in the region where attenuation first begins and as a slope further along the attenuation curve. These various filter properties are best described graphically in the form of a frequency plot (sometimes referred to as a Bode plot), a plot of filter gain against frequency. Filter gain is simply the ratio of the output voltage divided by the input voltage, Vout/ Vin, often taken in db. Technically this ratio should be defined for all frequencies for which it is nonzero, but practically it is usually stated only for the frequency range of interest. To simplify the shape of the resultant curves, frequency plots sometimes plot gain in db against the log of frequency.* When the output/input ratio is given analytically as a function of frequency, it is termed the transfer function. Hence, the frequency plot of a filter’s output/input relationship can be

*When gain is plotted in db, it is in logarithmic form, since the db operation involves taking the log [Eq. (6)]. Plotting gain in db against log frequency puts the two variables in similar metrics and results in straighter line plots.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

viewed as a graphical representation of the transfer function. Frequency plots for several different filter types are shown in Figure 1.7.

Filter Bandwidth

The bandwidth of a filter is defined by the range of frequencies that are not attenuated. These unattenuated frequencies are also referred to as passband frequencies. Figure 1.7A shows that the frequency plot of an ideal filter, a filter that has a perfectly flat passband region and an infinite attenuation slope. Real filters may indeed be quite flat in the passband region, but will attenuate with a

FIGURE 1.7 Frequency plots of ideal and realistic filters. The frequency plots shown here have a linear vertical axis, but often the vertical axis is plotted in db. The horizontal axis is in log frequency. (A) Ideal lowpass filter. (B) Realistic lowpass filter with a gentle attenuation characteristic. (C) Realistic lowpass filter with a sharp attenuation characteristic. (D) Bandpass filter.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

more gentle slope, as shown in Figure 1.7B. In the case of the ideal filter, Figure 1.7A, the bandwidth or region of unattenuated frequencies is easy to determine; specifically, it is between 0.0 and the sharp attenuation at fc Hz. When the attenuation begins gradually, as in Figure 1.7B, defining the passband region is problematic. To specify the bandwidth in this filter we must identify a frequency that defines the boundary between the attenuated and non-attenuated portion of the frequency characteristic. This boundary has been somewhat arbitrarily defined as the frequency when the attenuation is 3 db.* In Figure 1.7B, the filter would have a bandwidth of 0.0 to fc Hz, or simply fc Hz. The filter in Figure 1.7C has a sharper attenuation characteristic, but still has the same bandwidth ( fc Hz). The bandpass filter of Figure 1.7D has a bandwidth of fh fl Hz.

Filter Order

The slope of a filter’s attenuation curve is related to the complexity of the filter: more complex filters have a steeper slope better approaching the ideal. In analog filters, complexity is proportional to the number of energy storage elements in the circuit (which could be either inductors or capacitors, but are generally capacitors for practical reasons). Using standard circuit analysis, it can be shown that each energy storage device leads to an additional order in the polynomial of the denominator of the transfer function that describes the filter. (The denominator of the transfer function is also referred to as the characteristic equation.) As with any polynomial equation, the number of roots of this equation will depend on the order of the equation; hence, filter complexity (i.e., the number of energy storage devices) is equivalent to the number of roots in the denominator of the Transfer Function. In electrical engineering, it has long been common to call the roots of the denominator equation poles. Thus, the complexity of the filter is also equivalent to the number of poles in the transfer function. For example, a second-order or two-pole filter has a transfer function with a secondorder polynomial in the denominator and would contain two independent energy storage elements (very likely two capacitors).

Applying asymptote analysis to the transfer function, is not difficult to show that the slope of a second-order lowpass filter (the slope for frequencies much greater than the cutoff frequency, fc) is 40 db/decade specified in log-log terms. (The unusual units, db/decade are a result of the log-log nature of the typical frequency plot.) That is, the attenuation of this filter increases linearly on a log-log scale by 40 db (a factor of 100 on a linear scale) for every order of magnitude increase in frequency. Generalizing, for each filter pole (or order)

*This defining point is not entirely arbitrary because when the signal is attenuated 3 db, its amplitude is 0.707 (10−3/20) of what it was in the passband region and it has half the power of the unattenu-

ated signal (since 0.7072 = 1/2). Accordingly this point is also known as the half-power point.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

the downward slope (sometimes referred to as the rolloff ) is increased by 20 db/decade. Figure 1.8 shows the frequency plot of a second-order (two-pole with a slope of 40 db/decade) and a 12th-order lowpass filter, both having the same cutoff frequency, fc, and hence, the same bandwidth. The steeper slope or rolloff of the 12-pole filter is apparent. In principle, a 12-pole lowpass filter would have a slope of 240 db/decade (12 × 20 db/decade). In fact, this frequency characteristic is theoretical because in real analog filters parasitic components and inaccuracies in the circuit elements limit the actual attenuation that can be obtained. The same rationale applies to highpass filters except that the frequency plot decreases with decreasing frequency at a rate of 20 db/decade for each highpass filter pole.

Filter Initial Sharpness

As shown in Figure 1.8, both the slope and the initial sharpness increase with filter order (number of poles), but increasing filter order also increases the com-

FIGURE 1.8 Frequency plot of a second-order (2-pole) and a 12th-order lowpass filter with the same cutoff frequency. The higher order filter more closely approaches the sharpness of an ideal filter.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

plexity, hence the cost, of the filter. It is possible to increase the initial sharpness of the filter’s attenuation characteristics without increasing the order of the filter, if you are willing to except some unevenness, or ripple, in the passband. Figure 1.9 shows two lowpass, 4th-order filters, differing in the initial sharpness of the attenuation. The one marked Butterworth has a smooth passband, but the initial attenuation is not as sharp as the one marked Chebychev; which has a passband that contains ripples. This property of analog filters is also seen in digital filters and will be discussed in detail in Chapter 4.

FIGURE 1.9 Two filters having the same order (4-pole) and cutoff frequency, but differing in the sharpness of the initial slope. The filter marked Chebychev has a steeper initial slope or rolloff, but contains ripples in the passband.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

ANALOG-TO-DIGITAL CONVERSION: BASIC CONCEPTS

The last analog element in a typical measurement system is the analog-to-digital converter (ADC), Figure 1.1. As the name implies, this electronic component converts an analog voltage to an equivalent digital number. In the process of analog-to-digital conversion an analog or continuous waveform, x(t), is converted into a discrete waveform, x(n), a function of real numbers that are defined only at discrete integers, n. To convert a continuous waveform to digital format requires slicing the signal in two ways: slicing in time and slicing in amplitude (Figure 1.10).

Slicing the signal into discrete points in time is termed time sampling or simply sampling. Time slicing samples the continuous waveform, x(t), at discrete prints in time, nTs, where Ts is the sample interval. The consequences of time slicing are discussed in the next chapter. The same concept can be applied to images wherein a continuous image such as a photograph that has intensities that vary continuously across spatial distance is sampled at distances of S mm. In this case, the digital representation of the image is a two-dimensional array. The consequences of spatial sampling are discussed in Chapter 11.

Since the binary output of the ADC is a discrete integer while the analog signal has a continuous range of values, analog-to-digital conversion also requires the analog signal to be sliced into discrete levels, a process termed quantization, Figure 1.10. The equivalent number can only approximate the level of

FIGURE 1.10 Converting a continuous signal (solid line) to discrete format requires slicing the signal in time and amplitude. The result is a series of discrete points (X’s) that approximate the original signal.

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.

the analog signal, and the degree of approximation will depend on the range of binary numbers and the amplitude of the analog signal. For example, if the output of the ADC is an 8-bit binary number capable of 28 or 256 discrete states, and the input amplitude range is 0.0–5.0 volts, then the quantization interval will be 5/256 or 0.0195 volts. If, as is usually the case, the analog signal is time varying in a continuous manner, it must be approximated by a series of binary numbers representing the approximate analog signal level at discrete points in time (Figure 1.10). The errors associated with amplitude slicing, or quantization, are described in the next section, and the potential error due to sampling is covered in Chapter 2. The remainder of this section briefly describes the hardware used to achieve this approximate conversion.

Analog-to-Digital Conversion Techniques

Various conversion rules have been used, but the most common is to convert the voltage into a proportional binary number. Different approaches can be used to implement the conversion electronically; the most common is the successive approximation technique described at the end of this section. ADC’s differ in conversion range, speed of conversion, and resolution. The range of analog voltages that can be converted is frequently software selectable, and may, or may not, include negative voltages. Typical ranges are from 0.0–10.0 volts or less, or if negative values are possible ± 5.0 volts or less. The speed of conversion is specified in terms of samples per second, or conversion time. For example, an ADC with a conversion time of 10 sec should, logically, be able to operate at up to 100,000 samples per second (or simply 100 kHz). Typical conversion rates run up to 500 kHz for moderate cost converters, but off-the-shelf converters can be obtained with rates up to 10–20 MHz. Except for image processing systems, lower conversion rates are usually acceptable for biological signals. Even image processing systems may use downsampling techniques to reduce the required ADC conversion rate and, hence, the cost.

A typical ADC system involves several components in addition to the actual ADC element, as shown in Figure 1.11. The first element is an N-to-1 analog switch that allows multiple input channels to be converted. Typical ADC systems provide up to 8 to 16 channels, and the switching is usually softwareselectable. Since a single ADC is doing the conversion for all channels, the conversion rate for any given channel is reduced in proportion to the number of channels being converted. Hence, an ADC system with converter element that had a conversion rate of 50 kHz would be able to sample each of eight channels at a theoretical maximum rate of 50/8 = 6.25 kHz.

The Sample and Hold is a high-speed switch that momentarily records the input signal, and retains that signal value at its output. The time the switch is closed is termed the aperture time. Typical values range around 150 ns, and, except for very fast signals, can be considered basically instantaneous. This

Copyright 2004 by Marcel Dekker, Inc. All Rights Reserved.