0% found this document useful (0 votes)
65 views20 pages

CH 11

Biomedical Signal Processing chapter

Uploaded by

shivaspy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
65 views20 pages

CH 11

Biomedical Signal Processing chapter

Uploaded by

shivaspy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
ll Other Time- and Frequency-Domain Techniques Dorin Panescu A biomedical signal is often corrupted by noise (¢.g., powerline interference, mus- cle or motion artifacts, RF interference from electrosurgery or diathermy appara- tus). Therefore, it is useful to know the frequency spectrum of the corrupting signal in order to be able to design a filter to eliminate it. If we want to find out, for ex- ample, how well the patient's cardiac output is correlated with the area of the QRS complex, then we need to use proper correlation techniques. This chapter presents time and frequency-domain techniques that might be useful for situations such as those exemplified above. 11.1 THE FOURIER TRANSFORM The digital computer algorithm for Fourier analysis called the fast Fourier trans- form (FFT) serves as a basic tool for frequency-domain analysis of signals. 11.1.1 The Fourier transform of a discrete nonperiodic signal Assuming that a discrete-time aperiodic signal exists as a sequence of data sampled from an analog prototype with a sampling period of T,the angular sampling frequency being as = 2x/T, we can write this signal in the time domain as a series of weighted Dirac functions. Thus x()= x(n) &t - nT) (1.1) n 216 Other Time- and Frequency-Domain Techniques 217 The Fourier transform of this expression is x@= J x eiorde (11.2) or X(@) = J DL xm) &t-nT) eioar (11.3a) a ‘The ordering of integration and summation can be changed to give X@)= Y xn) J Ke-nTyeiora (11.3b) Thus we obtain DX xy) clon (11.3¢) nwa X(@) And similarly, we can find that the inverse Fourier transform is os x(n ad X(@) &OrT deo a4) One of the important properties of the Fourier transform, which is shown in Figure 11.1(b), is its repetition at intervals of the sampling frequency in both posi- tive and negative directions. Also it is remarkable that the components in the inter- val 0< @ < @s/2 are the complex conjugates of the components in the interval @s/2< @ < as. It is modem practice to use normalized frequencies, which means that the sampling period T is taken to be 1. Therefore, the Fourier transform pair for discrete signals, considering normalized frequencies, is X(@= LY x(n) evden (11.5a) i © x f X(@) el@nda (11.5b) = x(n) 218 Biomedical Digital Signal Processing ‘We observe that this kind of Fourier transform is continuous, and it repeats at in- tervals of the sampling frequency. Discrete signal Modulus: 20, (a) (b) Figure 11.1 (a) A discrete-time signal, and (b) the modulus of its Fourier transform. Symmetry about @s/2, due to the sampling process, is illustrated. 11.1.2 The discrete Fourier transform for a periodic signal The discrete Fourier transform (DFT) is the name given to the calculation of the Fourier series coefficients for a discrete periodic signal. The operations are similar to the calculation of Fourier coefficients for a periodic signal, but there are also certain marked differences. The first is that the integrals become summations in the discrete time domain. The second difference is that the transform evaluates only a finite number of complex coefficients, the total being equal to the original number of data points in one period of original signal. Because of this, each spectral line is regarded as the k-th harmonic of the basic period in the data rather than identifying with a particular frequency expressed in Hz or radian/s. Algebraically, the forward and reverse transforms are expressed as Nal kn 2m X= LY xe (11.6a) n=0 Nel ikn 2: xm=h D Xwew (11.60) k=0 Figure 11.2 shows a discrete periodic signal and the real and imaginary parts of its DFT. The first spectral line (k = 0) gives the amplitude of the de component in the signal, and the second line corresponds to that frequency which represents one Other Time- and Frequency-Domain Techniques 219 cycle in N data points. This frequency is 2n/N. The N-th line corresponds to the sampling frequency of the discrete N-sample data sequence per period and the k= N/2-th line corresponds to the Nyquist frequency. Using the symmetry of the DFT, algorithms for fast computation have been developed. Also, the symmetry has two important implications. The first is that the transformation will yield N unique complex spectral lines. The second is that half of these are effectively re- dundant because all of the information contained in a real time domain signal is contained within the first N/2 complex spectral lines. These facts permitted the de- velopment of the Fast Fourier ‘Transform (FFT), which is presented in the next section. Discrete signal 0123... NA n (a) (b) Figure 11.2 (a) A discrete periodic signal and (b) the real and imaginary parts of its DFT. 11.1.3 The fast Fourier transform For a complete discussion of this subject, see Oppenheim and Schafer (1975). The term FFT applies to any computational algorithm by which the discrete Fourier transform can be evaluated for a signal consisting of N equally spaced samples, with N usually being a power of two. To increase the computation efficiency, we must divide the DFT into successively smaller DFTs. In this process we will use the symmetry and the periodicity properties of the complex exponential Wii = eJOnmNykn where Wy substitutes for e2/), Algorithms in which the decomposition is based on splitting the sequence x(n) into smaller sequences are called decimation in time algorithms. The principle of decimation in time is presented below for N equal to an integer power of 2. We can consider, in this case, X(k) to be formed by two 220 Biomedical Digital Signal Processing N/2-point sequences consisting of the even-numbered points in x(n) and odd- numbered points in x(n), respectively. Thus we obtain x@= YD sew + Y xywy a7) n= pel n&%p which can also be written as N/2-1 N2=1 x= DY xOpywr+ YD xQp+ wees ve (11.8) p=0 p=0 But Wy = Wyo and consequently Eq. (11.8) can be written as N/2-1 N2-1 xo= ¥ xp) Whi + Wy La@r+ NWA =Xelk) + Wy Xo) (11.9) p= p= Each of the sums in Eq. (11.9) is an N/2-point DFT of the even- and odd-numbered points of the original sequence, respectively. ‘After the two DFTs are computed, they are combined to give the DFT for the original N-point sequence. We can proceed further by decomposing each of the two N/2-point DFTs into two N/4-point DFTs and each of the four N/4-point DFTs into two N/8-point DFTs, and so forth. Finally we reduce the computation of the N- point DFT to the computation of the 2-point DFTs and the necessary additions and multiplications. Figure 11.3 shows the computations involved in computing X(k) for an 8-point original sequence. Oppenheim and Schafer (1975) show that the total number of complex additions and multiplications involved is Nlog>N. The original N-point DFT requires N2 complex multiplications and additions; thus it turns out that the FFT algorithm saves us considerable computing time. Figure 11.4 shows the computation time for the FFT and the original DFT versus N. The FFT requires at least an order of magnitude fewer computations than the DFT. As an example, some modem microcomputers equipped with a math copro- cessor are able to perform an FFT for a 1024-point sequence in much less than 1 s. In the case when NV is not an integer power of 2, the common procedure is to aug- ment the finite-length sequence with zeros until the total number of points reaches the closest power of 2, or the power for which the FFT algorithm is written. This technique is called zero padding. In order to make the error as low as possible, sometimes the signal is multiplied with a finite-length window function. Windowing is also applied when N is an integer power of 2 but the FFT-analyzed signal does not contain an integer number of periods within the N points. In such cases, the error introduced by the unfinished period of the signal may be reduced by a proper choice of the window type. Other Time- and Frequency-Domain Techniques 221 Figure 11.3 The flow graph of the decimation-in-time of an 8-point DFT. 80000 —2— DFT computations ——t——-_ FFT computations SL 100 200 Number of points (NV) 60000 40000 Number of computations 300 Figure 11.4 Computational savings with the FFT. 222 Biomedical Digital Signal Processing 11.1.4 C-language FFT function ‘The computational flow graph presented in Figure 11.3 describes an algorithm for the computation of the FFT of finite-length signal applicable when the number of points is an integer power of 2. When implementing the computations depicted in this figure, we can imagine the use of two arrays of storage registers, one for the array being computed and one for the data being used in computation. For example, in computing the first array, one set of storage registers would contain the input data and the second set of storage registers would contain the computed results for the first stage. In order to perform the computation based on the “butterfly” graph, the input data must be stored in a nonsequential order. In fact, the order in which the input data must be stored is the bit-reversed order. To show what is meant by this, we write the index of the output data and the index of the corresponding input data using three binary digits. (000) — x(000) X(001) — x(100) X(010) — x(010) X(11) — x(110) X(100) — x(001) X(101) — x(101) X(110) — x11) X(111) — x(111) If (xg nq ng) is the binary representation of the index of the sequence x(n), which is the input data, then (x(n)} must be rearranged such that the new position of x(ng ny] ng) is x(n9 m1 2). Figure 11.5 shows a C-language fragment for the FFT computation, which reorders the input array, x[nn]. The FFT function in UW DigiScope allows the user to zero-pad the signal or to window it with the different windows. 11.2: CORRELATION We now investigate the concept of correlation between groups of data or between signals. Correlation between groups of data implies that they move or change with respect to each other in a structured way. To study the correlation between signals, we will consider signals that have been digitized and that therefore form groups of data. Other Time- and Frequency-Domain Techniques 223 ¥define RORD(a,b) tempr=(a); (a)=(b); (b) =tempr float tempr,x(512]; int i,3,m,n,nnz Inn=512; In=nn<4) { RORD(x(3],x[i])7/*this is the bit-reversal section of*/ RORD (x(}+1],x[i+1]);/*a FFT computation routine*/ ) men >>1; while (m>=2 && j>m){ j im >>1; ) jtsm; Figure 11.5 The C-language program for bit-reversal computations, 11.2.1 Correlation in the time domain For N pairs of data (x(m),y(n)}, the correlation coefficient is defined as N _ LY (e@)-x} {y@)-y) a eae 4) © (x) -x}2_Y (9) -y)2 a If finite-length signals are to be analyzed, then we must define the crosscorrela- tion function of the two signals. (11.10) N = = © (x(n) -x) +0 -y} ) = rxy(k) W a : > (x) - x}? Y (Oy -y}? n=l nel (11.11) 224 Biomedical Digital Signal Processing In the case when the two input signals are the same, the crosscorrelation function becomes the autocorrelation function of that signal. Thus, the autocorrelation func- tion is defined as N 7 = DY. (x(n) - x} (xn + &)- x) Tyxlk) (11.12) W & (x) -x)}? Figure 11.6 presents the crosscorrelation of respiratory signals recorded simulta~ neously from a human subject using impedance pneumography. In Figure 11.6(a), the signals were acquired at different points along the midaxillary line of the sub- ject. The subject was breathing regularly at the beginning of the recording, moving ‘without breathing in the middle of the recording, and breathing regularly again at the end. In Figure 11.6(b), each combination of two recorded channels were cross- correlated in order to try to differentiate between movement and regular breathing. 11.2.2 Correlation in the frequency domain ‘The original definition for the crosscorrelation was for continuous signals. Thus if h(e) and g(¢) are two continuous signals, then their crosscorrelation function is defined as con = J ght ddt (11.13) ‘The Fourier transform of the crosscorrelation function satisfies Corr (@) = Glw)* Hw) (1.14) where G(@)* is the complex conjugate of G(@). Thus if we consider h and g to be digitized, we may approximate the crosscorre- lation function as N-1 cant) = 5, 3) Mn) (11.15) i ‘This equation is also known as the biased estimator of the crosscorrelation func- tion, Between the DFTs of the two input discrete signals and the DFT of the biased estimator, we have the relationship Corr (k) = G(k)* H(k) (11.16) Other Time- and Frequency-Domain Techniques 225 eta yA (a) (b) Figure 11.6 Respiratory signals recorded using impedance pneumography. (a) From top to bot- tom, signals 1, 2, 3, and 4 were simultaneously recorded along the midaxillary line of a human subject using & sampling rate of 5 sps. (b) From top to bottom, the traces represent the crosscorrelation of the channels 1-2, 1-3, 1-4, 2-3, 2-4, 3-4, and the averaged correlation coefficient. The results show, in part, that channels 2 and 3 are highly correlated during normal breathing without motion, but not well correlated during motion without breathing. Thus, the crosscorrelation of the two discrete signals can also be computed as the inverse DFT of the product of their DFTs. This can be implemented using the FFT and inverse FFT (IFFT) algorithms for increasing the computational speed in the way given by cgh(n) = IFFT ( FFT*(g) * FFT(h)) (11.17) 11.2.3 Correlation function ‘The C-language program in Figure 11.7 computes the crosscorrelation function of two 512-point input sequences x[{512] and y[512] and stores the output data into rxy{512]. The idea of this program was used to implement the C-language function 226 Biomedical Digital Signal Processing to compute the crosscorrelation between an ECG signal and a template. In such a case, the array yl ] must have the same dimension as the template. 7* The crosscorrelation function of x1] and y(] is */ /* output into rxy[ ] */ void corr (float *x,float *y) ( int i,m,nz float s,sl,s2,xm,ym,t; float rxy(512)7 12; s=sl=s2=xm=ym=0.0; 4=0;i Sminutes Sminutes <| Cycles per minute phe N oul (a) (b) Figure 11.11 Electrogastrogram (EGG) of a diabetic patient. (a) Compressed spectral array (CSA). (b) Gray-scale plot. 11.4.5 Power spectrum function Figure 11.12 is a C-language function that computes the power spectrum for an N- point data sequence (N= 512). The input data are taken from an input buffer as integers, converted to floating-point format, and then used to compute the power spectrum. The output data are scaled and saved in an output file as integers after conversion from the floating-point format. The program presented is based on Welch’s idea of periodogram averaging, Thus, this function divides the input se- quence of data into two 256-point segments, windows each segment, and performs the power spectrum estimation for each segment. Finally, the results obtained for each segment are averaged and scaled according to the window effects. 11.5 LAB: FREQUENCY-DOMAIN ANALYSIS OF THE ECG This lab provides experience in studying the frequency characteristics of signals. Another resource for practice with these techniques is Alkin (1991). 11.5.1 Power spectral analysis of periodic signals Use (G) enwave to create sine wave and square wave signals at several different fundamental frequencies using several different sampling rates. Use the (2) wr Spect command to compute and observe the frequency spectrum of each 234 Biomedical Digital Signal Processing signal and comment on how sampling rate affects the results. How could you use a power spectrum routine to obtain the actual Fourier coefficients? 11.5.2 Power spectral analysis of an ECG 1, Use the (P)wx Spect command to find the frequency corresponding to the main peak in the frequency spectrum of an ECG. Is the result what you expected? 2. Select ad(v) ops from the main menu, and choose a QRS complex using (1) emplate. Use the (P)wr Spect command to find the spectrum of the zero- padded QRS complex. Is the frequency corresponding to the main peak in the fre- quency spectrum of the QRS complex what you expected? 3. After selecting a QRS complex template, use the (w) indow command to win- dow the selected template, and then run the (P) wx Spect command. Document the effects of the various windows. 4, Select a P-QRS-T segment as a template. Using the (p)wr spect command, find the power spectrum estimate for an ECG. Find the frequency corresponding to the main peak in the frequency spectrum of an ECG. How does it differ from the results of part 1? ¥define WINDOW (J, a,b) (1.0-fabs((((3)-1)- (al) *(b}))/*paraen */ define SQR(a) (sqrarg=(a), sqrarg*sararg) /*modulus of a, squared*/ for (j=1; j<=mms 34+) ( INDOW (3, facm, facp) ; w1(2*j-2] *sw; /* the real part of then data segment is windowed */ 0; /*the imaginary part is set to zero */ wi(2*j-1] = ! fft(wi-1,mm,1); /*the fft of the windowed signal is performed*/ /* the power spectrum estimate for the windowed data segment is computed */ p[0] SQR(w1 [0] +SOR(w1(1]))¢ for (j=l; j

You might also like