Mechanical Systems and Signal Processing (1996) 10(2), 211221
CORRECTIONSFOR FREQUENCY, AMPLITUDE
AND PHASE IN A FAST FOURIER TRANSFORM OF A HARMONIC SIGNAL Xir MiNc :Nb DiNc K:Nc Automobile Faculty, Chongqing University, Chongqing, P.R. China (Received November 1994, accepted June 1995) This paper advances a new method which can correct the spectrum peak value of the rms spectrum in order to decrease the errors that exist when the spectral line is not on the peak. The authors rst use the barycentre of spectral lines in the main lobe to obtain the coordinate of the spectrum peak. By this means the accurate frequency, amplitude and phase of the spectrum peak are obtained. 7 1996 Academic Press Limited 1. INTRODUCTION In spectrumanalysis, the spectral line of the rms spectrumobtained fromthe discrete Fourier transform (DFT) or the fast Fourier transform (FFT) is discrete. It is the resampled result of the complex convolution of the signal spectrumand windowfunction spectrumwith equal frequency intervals of Dv=2p/N [1] (Fig. 1). When the number of analysed points is N, and the sampling frequency is f s , the interval of spectral lines (which is also called the resolution ratio of frequency) is f s /N. This is the so-called comb eect. If the periodical signal frequency coincides with a spectral line the frequency, the amplitude and phase obtained are precise. The signal frequency is usually between two spectral lines and does not overlap the spectrum peak (the centre of the main lobe), the frequency and amplitude then represented are not precise, the phase error is larger. We can calculate the co-ordinates of the main lobe centre (point A in Fig. 1) with the help of the spectral lines in the main lobe, and we can then obtain precise frequency, amplitude and phase. This is the correction technique of spectrum analysis. As the shape of the main lobes of dierent window function are dierent, they will be discussed individually. 2. RECTANGULAR WINDOW In spectrum analysis, the rectangular window is dened as [2] W(n) =1 n =0, 1, 2, . . . , N1. (1) The spectrum function is: W(v) = sin (Nv/2) sin (v/2) e j(N1)v/2 . (2) 211 08883270/96/020211 +11 $18.00/0 7 1996 Academic Press Limited x. xiNc :Nb b. i:Nc 212 Figure 1. Discrete spectral lines resampled in frequency domain. Where W(v) is a complex function, and its modulus is (Fig. 2) W 0 (v) = sin (Nv/2) sin (v/2) . (3) When v:0, W 0 (v):N; where v=2pK/N (K=21, 22, . . .), W 0 (v) =0. In the DFT frequency resolution ratio (the interval of speectral lines) is Dv=2p/N (4) then v=Dv K=2pK/N (K=0, 1, . . . , N/2 1). (5) Equation (5) and Fig. 2(a) show that the width of the main lobe is equal to two intervals of spectral lines, i.e. there exist two spectral lines within the main lobe. When the centre of the main lobe coincides with one spectral line, the nearby spectral lines should coincide with the zero point of W 0 . There is then no frequency leakage in the frequency domain. Substituting equation (5) into (3), yields W 0 (K) = sin (pK) sin (pK/N) . (6) The main lobe zone is one within K=21, at this time Nw1 and 1/N:0, so sin (pK/N) 1pK/N. Then in the main lobe zone we can deduce W 0 (K) = sin (pK) pK/N =N sin (pK) pK . (7) While evaluating the amplitude spectrum from the results of DFT or FFT, we have to use the multiple coecient 1/N to eliminate N in equation (7), the amplitude then equals Figure 2. Spectrum of a rectangular window and its correction method. (a) Modulus function of a frequency spectrum; (b) main lobe function and barycentre method. corrrc1ioNs or rr1 or : n:rxoNic sicN:i 213 the one in the time domain. In the following discussion, N is not always an integer and so we replace K by X, and W 0 by Y, then equation (7) can be changed to Y= sin (pX) pX . (8) This is the main lobe function of the rectangular window shown in Fig. 2(b), and can be used for spectrum correction. The function Y=f(X) =sin (pX)/pX fullls X f(X) +(X+1) f(X+1) =0. (9) This is demonstrated by X sin (pX) pX +(X+1) sin [p(X+1)] p(X+1) = sin (pX) p + sin (pX+p) p = sin (pX) p
sin (pX) p =0. Equation (9) shows the barycentre of two arbitrary points P 1 (X 1 , Y 1 ), P 2 (X 2 , Y 2 ) in Fig. 2(b) is the origin of the co-ordinate when =X 1 X 2 = =1. If P 1 and P 2 are both within the main lobe as in the spectrum sampling, the abscissa of the centre of the main lobe can be calculated by employing the barycentre method. 2.1. rrrqirNc. corrrc1ioN or 1nr rrc1:Ncii:r viNbov Figure 3 shows the result of the amplitude spectrum sampled in the frequency domain. The abscissa can be expressed by spectral line number (K=0 0N/2 1), the corresponding frequency is f =K f s N . (10) According to the barycentre method, one can obtain the abscissa (X 0 ) of the main lobe of the barycentre by using two adjacent spectral lines K and K1 in the main lobe with the highest amplitudes. The abscissa (X 0 ) is X 0 = (K1)Y k 1 +KY k Y k +Y k 1 =K+ Y k 1 Y k +Y k 1 . In the same way, by using K and K+1, the abscissa of the main lobe barycentre is X 0 =K+ Y k +1 Y k +Y k +1 . (11) Let X 0 =K+DK, Then the frequency correction equation is obtained. DK=G G G K k Y k +1 Y k +1 +Y k Y k 1 Y k +Y k 1 (Y k +1 eY k 1 ) 0 EDKE1 (Y k +1 EY k 1 ) 1 EDKE0. (12) Figure 3. Frequency correction of a rectangular Figure 4. Phase of a rectangular window. window. x. xiNc :Nb b. i:Nc 214 The corrected frequency is f =(K+DK) f s N . (13) 2.2. :xiii1ibr corrrc1ioN or : rrc1:Ncii:r viNbov The main lobe function of Fig. 3 is Y=A sin [p(XX 0 )] p(XX 0 ) . (14) Which equals equation (8) multiplied by coecient A and translated to point X=X 0 . X 0 and A are the frequency and amplitude of the analysed signal respectively. Y k and Y k 1 are two spectrum lines in the main lobe. Combining equations (11) and (12) we can obtain X 0 , then substituting X 0 , Y=Y k and X=K into equation (14), A can be obtained: A= p(X 0 K)Y k sin [p(X 0 K)] . Where X 0 K=DK, DKcan be obtained fromequation (12), then the amplitude correction formula is A= pDKY k sin (pDK) . (15) 2.3. in:sr corrrc1ioN or : rrc1:Nciir viNbov From equation (2), the phase angle of the rectangular window frequency spectrum function can be obtained c= N1 2 v. (16) Substituting equation (5) into (16), c can be written as c= N1 2 2p N K= N1 N pK. (17) Within the main lobe, (N1)/N11, then v=Kp. (18) Equation (18) shows that the rectangular window phase is linear (Fig. 4). Complex convolution of the signal frequency function and the frequency spectrum function of the window function is done by the multiplication of a complex number i.e. to add their phase angles. If spectral line correction DK is between 0.50.5, one can deduce from equation (18) that the errors led by phase angle c is between p/2 0p/2. This illustrates why the phase information in spectrum analysis is useless without correction. The correction of the phase is Dc=Kp. (19) Assume that the actual FFT is R k and the imaginary FFT is I k . Then the corrected phase angle is u k =tg 1 (I k /R k ) +Dc. (20) corrrc1ioNs or rr1 or : n:rxoNic sicN:i 215 Because the side lobe of a rectangular window is the highest if there are multi-frequency components, it is necessary to use other kinds of window function to decrease the eect of the side lobe on the other main lobes. 3. HANNING WINDOW In spectrum analysis, the Hanning window is dened as [3] W(n) =a (1 a) cos (2pn/N) n =0, . . . , N1. (21) Its frequency spectrum function is: W(v) = 6 aD(v) + 1 2 (1 a) $ D 0 v 2p N 1 +D 0 v+ 2p N 1%7 e jNv/2 . (22) Where D(v) =sin (Nv/2)/sin (v/2) e jv/2 is the Dirichlet kernel. When a =0.5, in the Hanning window and a =0.54 is the Hamming window, the three terms in parentheses in equation (22) have phase dierences 2p/N. Neglecting the phase dierences among the three terms (when N is large enough) taking the sum of the modulus function of these terms as the modulus function of W(v) and referring to the deducing condition of equation (6), (7) and (8), we can obtain the Hanning window main lobe function. Y=a sin (pX) p/X + 1 a 2 6 sin [(pX1)] p(X1) + sin [p(X1)] p(X1) 7 = sin (pX) pX
a +(1 2a)X 2 1 X 2 . (23) When X:0, Y:a. When X:21, according to LHospitals rule, the following equation can be obtained lim X:21 sin (pX)[a +(1 2a)X 2 ] pX(1 X 2 ) = 1 a 2 (23a) while a =0.5 equation (23) becomes Y= sin (pX) pX
1 2(1 X 2 ) . (24) This is the main lobe function of the Hanning window. Comparing equation (24) with (8), the main lobe function of the Hanning window equals that of the rectangular window multiple coecient 1/2(1 X 2 ), this is shown in Fig. 5(a). Figure 5. Hanning window spectrum and correction method. (a) Main lobe function; (b) barycentre method. x. xiNc :Nb b. i:Nc 216 Zone (2, 2) is the main lobe. Usually there are four spectral lines. Similar to the case for a rectangular window, function Y=f(X) =sin (pX)/pX 1/ 2(1 X 2 ) fullls Xf(X) +(X+1)f(X+1) =f(X) f(X1). (25) The dierence is that the right side of equation (25) is not zero, but the dierence between the two points. For example: equation (25) can be written as (X1)f(X) +(X+2)f(X+1) =0 (26) (X1)f(X) =(X1) sin (pX) pX
1 2(1 X 2 ) = sin (pX) 2pX(1 +X) (27a) (X+2)f(X+1) =(X+2) sin (p(X+1)) p(X+1)
1 2[1 (X+1) 2 ] = sin (pX) 2pX(1 +X) . (27b) Adding equation (27a) and (27b) one gets zero and the proposition is therefore demonstrated. Equation (26) shows that selecting two points P(X, Y) and P(X 1 , Y 1 ) arbitrarily in Fig. 5(b) when =XX 1 = =1, moving the left point one graduation to the left and the right position one graduation to the right, the barycentre of these two points is the origin of the co-ordinate. For example in Fig. 5(b) the barycentre of points Y' and Y' 1 is the origin of the co-ordinate. Equation (26) ts each point of equation (24) in the function zone, but it is only applicable in the main lobe zone when the amplitude spectrum made has an absolute value. 3.1. rrrqirNc. corrrc1ioN or : n:NNiNc viNbov Similar to the case for a rectangular window using two spectrum lines Y k , Y k 1 of the amplitude spectrum peaks in the main lobe, the barycentre co-ordinate X 0 can be obtained X 0 = (k 1)Y k +(k +2)Y k +1 Y k +Y k +1 =K+ 2Y k +1 Y k Y k +Y k +1 . In the same way, by using spectral lines Y k 1 , Y k the barycentre co-ordinate is X 0 =K+ Y k 2Y k 1 Y k +Y k 1 . Let X 0 =K+DK, then the frequency correction formula is DK=G G G K k 2Y k +1 Y k Y k +1 +Y k Y k 2Y k 1 Y k +Y k 1 (Y k +1 eY k 1 ) (Y k +1 QY k 1 ). (28) Substituting DK with equation (13) one can obtain the corrected frequency. 3.2. :xiii1ibr corrrc1ioN or : n:NNiNc viNbov Equation (24) can be transformed to Y=A sin [p(XX 0 )] p(XX 0 )
1 2[1 (XX 0 ) 2 ] . (29) corrrc1ioNs or rr1 or : n:rxoNic sicN:i 217 Figure 6. Line spectrum of a rectangular window. Substituting Y=Y k , XX 0 =K, into equation (29) the corrected amplitude can be obtained A= pDKY k sin (pDK) 2(1 DK 2 ). (30) Comparison with equation (15) shows that equation (30) has a factor 2(1 DK 2 ). While using equation (30), one has to be aware that sin (pDK):0, otherwise the calculation might overow. At this moment DK:0, DK:21, then equation (30) can be transformed to lim DK:0 A=2Y k (31) lim DK:21 A=4Y k . (32) Equations (31) and (32) show that the amplitude needs to be corrected although the spectral line overlaps the main lobe centre (DK=0), this is because the energy decreases in the time domain after windowing. 3.3. in:sr corrrc1ioN or : n:NNiNc viNbov From equation (22) we can obtain the phase factor to the Hanning window as e jv/2 e jNv/2 =e j(N1)v/2 . Similar to the rectangular window, the phase correction can be obtained using equations (19) and (20). The width of the main lobe must equal the intervals of the four spectral lines, DK is between the zone of [2, 2]. The correction Dc is dierent but while Dc is restrained in domain [p, p], there is no dierence. 4. EXAMPLE Produce the function shown in equation (33) by the use of a computer. With sampling frequency 1024 Hz, and carrying out FFT (1024 points) the frequency interval is 1 Hz, the precise amplitude of one-side of the amplitude spectrum is 1. This makes it easy to observe the corrected errors. Y=z2 cos (2p123.2t +10p/180) +z2 cos (2p143.4t +20p/180) +z2 cos (2p385.7t +30p/180). (33) x. xiNc :Nb b. i:Nc 218 T:nir 1 Multi-frequency signal spectrum analysis results (when using Hanning window, the recovery coecient is 2) Rectangular window Hanning window PF (Hz) PA PP () PF (Hz) PA PP () 123.0 0.947477 46.41 123.0 0.974466 46.06 143.0 0.750533 92.22 143.0 0.901542 91.93 386.0 0.859470 24.18 386.0 0.941596 24.13 PF, Peak frequency; PA, peak amplitude; PP, peak phase. Figure 7. Line spectrum of a Hanning window. Figure 6 is the spectrumanalysis result of equation (33) without correction, it is obvious that the analysis error is larger. Taking the frequency component 386.7 Hz as an example, we can see that the amplitude error is 14.1%, the frequency error is 0.3 Hz and the phase error is 54.18. Substituting the spectrum components 385 Hz, 386 Hz and their corresponding amplitudes 0.368611 and 0.85947 V into equations (12), (13), (15) and (20), we can obtain the corrected results as follows DK= Y k 1 Y k +Y k 1 = 0.368611 0.368611 +0.85947 =0.300152. The corrected frequency is f =(K+DK) f s N =386 +(0.300152) =385.699848. The corrected amplitude is A= pDKY k sin (pDK) = 3.1415926 (0.300152) 0.859470 sin [3.1415926 (0.300152)] =1.001414. The corrected phase is u k =tg 1 0 I k R k1 DKp =tg 1 0 0.352020 0.784073 1 180 p (0.300152 ( 180) =29.84902. After correction the amplitude error is 1.4-, the frequency error is 0.0002 Hz, the phase error is 0.15, it can be clearly seen that the spectrum precision has been improved greatly. corrrc1ioNs or rr1 or : n:rxoNic sicN:i 219 By using a similar method we obtain Table 1 ,which shows the corrected results and the error analysis of a multi-frequency signal spectrum. Figure 7 is the frequency spectrum analysis result of equation (33) using the Hanning window, the amplitude error is smaller than when using a rectangular window. Taking the frequency component 386.7 Hz as an example, we can see the amplitude error is 5.84%, the frequency error is 0.3 Hz and the phase error is 54.14. Substituting the spectrumcomponents 385 and 386 Hz and their correspondent amplitude 0.724560 and 0.941596 Vinto equations (28), (13), (30) and (20), we can obtain the corrected results as follows DK= Y k 2Y k 1 Y k +Y k 1 = 0.941596 2 0.724560 0.941596 +0.724560 =0.304608. The corrected frequency is f =(K+DK) f s N =386 +(0.304608) =385.6954 Hz. The corrected amplitude is A= pDKY k sin (pDK) 2(1 DK 2 ) = p 0.304608 0.941596 sin (p 0.304608) 2 (1 0.304608 2 ) =1.000021. The corrected phase is u k =tg 1 0 I k R k1 DKp =tg 1 0 0.057182 0.129852 1 180 p (0.304608 ( 180) =30.6964. After correction, the amplitude error is 0.02-, the frequency error is 0.0045 Hz, the phase error is 0.6964. Compared with the rectangular window the amplitude error is smaller. By using a similar method we obtain Table 2, which shows the corrected results and the error analysis of a multi-frequency signal spectrum. When the interval between the two spectra is smaller, the correction precision of the Hanning window is better than that of the rectangular window. When frequency intervals are suciently large (such as the frequency component 385.7 Hz in this example) we can obtain higher correction accuracy using either the rectangular T:nir 2 Multi-frequency spectrum analysis correction results Window function CF (Hz) FAE CA AAE CP () PAE Rectangular 123.1893 1.07 10 2 1.005757 5.757 10 3 12.3870 2.3870 window 143.4047 4.7 10 3 0.998744 1.436 10 3 19.3628 0.6327 385.6998 2.0 10 4 1.001414 1.414 10 3 29.8490 0.151 Hanning 123.2001 1.0 10 4 1.000016 1.6 10 5 10.0475 0.0475 window 143.3989 1.1 10 3 1.000020 2.0 10 5 20.1354 0.1354 385.6954 4.6 10 3 1.000021 2.1 10 5 30.6964 0.6964 CF, Correction frequency; FAE, frequency absolute error; CA, correction amplitude; AAE, amplitude absolute error; CP, corrected phase; PAE, phase absolute error. x. xiNc :Nb b. i:Nc 220 windowor the Hanning window. At this time the absolute errors of frequency and amplitude are about 1-and the phase error is also small. The nearer the two frequencies are, the lower the correction is. In the former example, 123.2 and 143.4 Hz are separated by 20 spectral lines, the correction errors of the frequency and amplitude are obviously larger. The frequency error increases from 1- to 1%and the phase error is also larger. According to theory this correction method should not be used if the frequency interval is less than four times that of the frequency resolution ratio as the frequency spectrummain lobe will overlap. 5. CONCLUSION Correction techniques for frequency, amplitude and phase in spectrum analysis can greatly increase the accuracy of discrete spectrum analysis. They have solved the problem of obtaining high precision frequency and amplitude, both in theory and practice, and also developed a useful technique to measure signal parameters precisely. This technique is characterised by a simple algorithm and high calculation speed. The shortcomings are that only two very useful window functions have been used, although there are many kinds, and that the technique is not suitable for analysis where the frequency is very concentrated. REFERENCES 1. E. O. Broicn:x 1984 Fast Fourier Transform (FFT), pp. 110119. Shanghai: Shanghai Science and Technology Publishing. 2. ZnoNci:Nc SiN, 1982 Fast Fourier Transform (FFT) and Its Application, pp. 218221. Beijing: Post and Telecommunications Publishing House of the People. 3. Cn:oni:N Hoi 1990 Practical Signal Processing Technique of Fast Fourier Transform (FFT), pp. 6873. Beijing: Oceans Publishing House. 4. Hi:Nc Disn:N 1995 Mechanical Systems and Signal Processing 9, 113118. Phase error in fast Fourier transform analysis. APPENDIX A: NOMENCLATURE Dv frequency interval N point numbers of sequence analysed n point no. of sequence analysed (n =0, 1, 2, . . . , N1) fs sampling frequency W(n) window function f frequency (or corrected frequency) v frequency (v=2pf) W(v) frequency spectrum function of window W0(v) modulus of window frequency spectrum function K no. of spectrum lines X no. of spectrum lines (X is not always integer) W0(v), Y, f(X) modulus of window discrete frequency spectrum function X0 the abscissa of the main lobe barycentre DK correction of spectrum lines A the corrected amplitude of the signal analysed c phase angle of window frequency spectrum function Dc correction of c uk the corrected phase angle function D(v) Dirichlet kernel corrrc1ioNs or rr1 or : n:rxoNic sicN:i 221 APPENDIX B Huang Dishan [4], has recently published a paper on this topic. Our work diers in that the present paper is based on discrete frequency spectrum analysis. Using the barycentre method, the paper commences with frequency correction and then covers amplitude and phase correction. All of the equations use discrete formulae and the deduction of the phase correction is therefore very concise. The correction techniques presented in this paper can be used for rectangular and Hanning windows. Huang Dishan commences with phase correction and then covers frequency and amplitude correction. As most of the solutions are based on the continuous frequency spectrum the problem increases in complexity and is only suitable for the correction of rectangular windows.