Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

11
Mechanical Systems and Signal Processing (1996) 10(2), 211–221 CORRECTIONS FOR FREQUENCY, AMPLITUDE AND PHASE IN A FAST FOURIER TRANSFORM OF A HARMONIC SIGNAL X M D K 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 first 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 spectrum analysis, the spectral line of the rms spectrum obtained from the discrete Fourier transform (DFT) or the fast Fourier transform (FFT) is discrete. It is the resampled result of the complex convolution of the signal spectrum and window function spectrum with 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 effect. 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 different window function are different, they will be discussed individually. 2. RECTANGULAR WINDOW In spectrum analysis, the rectangular window is defined as [2] W(n )=1 n = 0, 1, 2, . . . , N - 1. (1) The spectrum function is: W(v)= sin (Nv/2) sin (v/2) e -j(N - 1)v/2 . (2) 211 0888–3270/96/020211 + 11 $18.00/0 7 1996 Academic Press Limited

description

Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

Transcript of Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

Page 1: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

Mechanical Systems and Signal Processing (1996) 10(2), 211–221

CORRECTIONS FOR FREQUENCY, AMPLITUDEAND PHASE IN A FAST FOURIER TRANSFORM

OF A HARMONIC SIGNAL

X M D K

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 rmsspectrum in order to decrease the errors that exist when the spectral line is not on the peak.The authors first use the barycentre of spectral lines in the main lobe to obtain the coordinateof the spectrum peak. By this means the accurate frequency, amplitude and phase of thespectrum peak are obtained.

7 1996 Academic Press Limited

1. INTRODUCTION

In spectrum analysis, the spectral line of the rms spectrum obtained from the discrete Fouriertransform (DFT) or the fast Fourier transform (FFT) is discrete. It is the resampled resultof the complex convolution of the signal spectrum and window function spectrum with equalfrequency intervals of Dv=2p/N [1] (Fig. 1). When the number of analysed points is N,and the sampling frequency is fs , the interval of spectral lines (which is also called theresolution ratio of frequency) is fs /N. This is the so-called comb effect. If the periodical signalfrequency coincides with a spectral line the frequency, the amplitude and phase obtainedare precise. The signal frequency is usually between two spectral lines and does not overlapthe spectrum peak (the centre of the main lobe), the frequency and amplitude thenrepresented are not precise, the phase error is larger. We can calculate the co-ordinates ofthe 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 correctiontechnique of spectrum analysis. As the shape of the main lobes of different window functionare different, they will be discussed individually.

2. RECTANGULAR WINDOW

In spectrum analysis, the rectangular window is defined as [2]

W(n)=1 n=0, 1, 2, . . . , N−1. (1)

The spectrum function is:

W(v)=sin (Nv/2)sin (v/2)

e−j(N−1)v/2. (2)

211

0888–3270/96/020211+11 $18.00/0 7 1996 Academic Press Limited

Page 2: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

. . 212

Figure 1. Discrete spectral lines resampled in frequency domain.

Where W(v) is a complex function, and its modulus is (Fig. 2)

W0(v)=sin (Nv/2)sin (v/2)

. (3)

When v:0, W0(v):N; where v=2pK/N (K=21, 22, . . .), W0(v)=0. In the DFTfrequency 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 intervalsof spectral lines, i.e. there exist two spectral lines within the main lobe. When the centre ofthe main lobe coincides with one spectral line, the nearby spectral lines should coincide withthe zero point of W0. There is then no frequency leakage in the frequency domain.

Substituting equation (5) into (3), yields

W0(K)=sin (pK)

sin (pK/N). (6)

The main lobe zone is one within K=21, at this time Nw 1 and 1/N:0, sosin (pK/N)1 pK/N. Then in the main lobe zone we can deduce

W0(K)=sin (pK)pK/N

=Nsin (pK)

pK. (7)

While evaluating the amplitude spectrum from the results of DFT or FFT, we have touse the multiple coefficient 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 frequencyspectrum; (b) main lobe function and barycentre method.

Ignacio
Resaltado
ancho
Ignacio
Resaltado
proximo, cercano
Ignacio
Resaltado
es logico pues, si no hay fuga, se vera que caven dos df en el lobulo principal, entre esos dos df estara la frec principal.
Ignacio
Resaltado
dentro, dentro de
Ignacio
Nota adhesiva
The main lobe zone is one within... ? no entiendo por que.
Ignacio
Resaltado
esto es por que la transformada de la ventana no ha sido desplazada y es de esperarse que el lobulo principal este en K aprox =0 entre -1 y 1
Page 3: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

213

the one in the time domain. In the following discussion, N is not always an integer and sowe replace K by X, and W0 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 beused for spectrum correction. The function Y= f(X)= sin (pX)/pX fulfills

X · f(X)+ (X+1) · f(X+1)=0. (9)

This is demonstrated by

Xsin (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 P1(X1, Y1), P2(X2, Y2) inFig. 2(b) is the origin of the co-ordinate when =X1 −X2==1. If P1 and P2 are both withinthe main lobe as in the spectrum sampling, the abscissa of the centre of the main lobe canbe calculated by employing the barycentre method.

2.1.

Figure 3 shows the result of the amplitude spectrum sampled in the frequency domain.The abscissa can be expressed by spectral line number (K=00N/2−1), the correspondingfrequency is

f=K ·fs

N. (10)

According to the barycentre method, one can obtain the abscissa (X0) of the main lobe ofthe barycentre by using two adjacent spectral lines K and K−1 in the main lobe with thehighest amplitudes. The abscissa (X0) is

X0 =(K−1)Yk−1 +KYk

Yk +Yk−1=K+

−Yk−1

Yk +Yk−1.

In the same way, by using K and K+1, the abscissa of the main lobe barycentre is

X0 =K+Yk+1

Yk +Yk+1. (11)

Let X0 =K+DK, Then the frequency correction equation is obtained.

DK=GG

G

K

k

Yk+1

Yk+1 +Yk

−Yk−1

Yk +Yk−1

(Yk+1 eYk−1) 0EDKE 1

(Yk+1 EYk−1) −1EDKE 0.(12)

Figure 3. Frequency correction of a rectangular Figure 4. Phase of a rectangular window.window.

Ignacio
Resaltado
cumple
Ignacio
Resaltado
Ignacio
Nota adhesiva
Esta ecuacíon se debe tratar de implementar en matlab.
Page 4: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

. . 214

The corrected frequency is

f=(K+DK) ·fs

N. (13)

2.2.

The main lobe function of Fig. 3 is

Y=Asin [p(X−X0)]

p(X−X0). (14)

Which equals equation (8) multiplied by coefficient A and translated to point X=X0. X0

and A are the frequency and amplitude of the analysed signal respectively. Yk and Yk−1 aretwo spectrum lines in the main lobe. Combining equations (11) and (12) we can obtain X0,then substituting X0, Y=Yk and X=K into equation (14), A can be obtained:

A=p(X0 −K)Yk

sin [p(X0 −K)].

Where X0 −K=DK, DK can be obtained from equation (12), then the amplitude correctionformula is

A=pDKYk

sin (pDK). (15)

2.3.

From equation (2), the phase angle of the rectangular window frequency spectrumfunction can be obtained

c=−N−1

2v. (16)

Substituting equation (5) into (16), c can be written as

c=−N−1

22p

NK=−

N−1N

pK. (17)

Within the main lobe, (N−1)/N1 1, 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. toadd their phase angles. If spectral line correction DK is between −0.5–0.5, one can deducefrom equation (18) that the errors led by phase angle c is between −p/20 p/2. Thisillustrates 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 Rk and the imaginary FFT is Ik . Then the corrected phaseangle is

uk =tg−1 (Ik /Rk )+Dc. (20)

Page 5: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

215

Because the side lobe of a rectangular window is the highest if there are multi-frequencycomponents, it is necessary to use other kinds of window function to decrease the effect ofthe side lobe on the other main lobes.

3. HANNING WINDOW

In spectrum analysis, the Hanning window is defined as [3]

W(n)= a−(1− a) cos (2pn/N) n=0, . . . , N−1. (21)

Its frequency spectrum function is:

W(v)=6aD(v)+ 12(1− a) $D0v−

2p

N1+D0v+2p

N1%7 e−jNv/2. (22)

Where D(v)= sin (Nv/2)/sin (v/2) ejv/2 is the Dirichlet kernel. When a=0.5, in theHanning window and a=0.54 is the Hamming window, the three terms in parentheses inequation (22) have phase differences 2p/N. Neglecting the phase differences among the threeterms (when N is large enough) taking the sum of the modulus function of these terms asthe 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= asin (pX)

p/X+

1− a2 6sin [(pX−1)]

p(X−1)+

sin [p(X−1)]p(X−1) 7

=sin (pX)

pX·a+(1−2a)X2

1−X2 . (23)

When X:0, Y:a. When X:21, according to L’Hospital’s rule, the following equationcan be obtained

limX:21

sin (pX)[a+(1−2a)X2]pX(1−X2)

=1− a

2(23a)

while a=0.5 equation (23) becomes

Y=sin (pX)

pX·

12(1−X2)

. (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 coefficient 1/2(1−X2), this is shown in Fig. 5(a).

Figure 5. Hanning window spectrum and correction method. (a) Main lobe function; (b) barycentre method.

Page 6: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

. . 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−X2) fulfills

Xf(X)+ (X+1)f(X+1)= f(X)− f(X−1). (25)

The difference is that the right side of equation (25) is not zero, but the difference betweenthe two points.For example: equation (25) can be written as

(X−1)f(X)+ (X+2)f(X+1)=0 (26)

(X−1)f(X)= (X−1)sin (pX)

pX·

12(1−X2)

=−sin (pX)2pX(1+X)

(27a)

(X+2)f(X+1)= (X+2)sin (p(X+1))

p(X+1)·

12[1− (X+1)2]

=sin (pX)

2pX(1+X). (27b)

Adding equation (27a) and (27b) one gets zero and the proposition is thereforedemonstrated.

Equation (26) shows that selecting two points P(X, Y) and P(X1, Y1) arbitrarily inFig. 5(b) when =X−X1==1, moving the left point one graduation to the left and the rightposition one graduation to the right, the barycentre of these two points is the origin of theco-ordinate. For example in Fig. 5(b) the barycentre of points Y' and Y'1 is the origin of theco-ordinate. Equation (26) fits each point of equation (24) in the function zone, but it is onlyapplicable in the main lobe zone when the amplitude spectrum made has an absolute value.

3.1.

Similar to the case for a rectangular window using two spectrum lines Yk , Yk−1 of theamplitude spectrum peaks in the main lobe, the barycentre co-ordinate X0 can be obtained

X0 =(k−1)Yk +(k+2)Yk+1

Yk +Yk+1=K+

2Yk+1 −Yk

Yk +Yk+1.

In the same way, by using spectral lines Yk−1, Yk the barycentre co-ordinate is

X0 =K+Yk −2Yk−1

Yk +Yk−1.

Let X0 =K+DK, then the frequency correction formula is

DK=GG

G

K

k

2Yk+1 −Yk

Yk+1 +Yk

Yk −2Yk−1

Yk +Yk−1

(Yk+1 eYk−1)

(Yk+1 QYk−1).(28)

Substituting DK with equation (13) one can obtain the corrected frequency.

3.2.

Equation (24) can be transformed to

Y=Asin [p(X−X0)]

p(X−X0)·

12[1− (X−X0)2]

. (29)

Page 7: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

217

Figure 6. Line spectrum of a rectangular window.

Substituting Y=Yk , X−X0 =K, into equation (29) the corrected amplitude can beobtained

A=pDKYk

sin (pDK)· 2(1−DK2). (30)

Comparison with equation (15) shows that equation (30) has a factor 2(1−DK2). Whileusing equation (30), one has to be aware that sin (pDK):0, otherwise the calculation mightoverflow. At this moment DK:0, DK:21, then equation (30) can be transformed to

limDK:0

A=2Yk (31)

limDK:21

A=4Yk . (32)

Equations (31) and (32) show that the amplitude needs to be corrected although the spectralline overlaps the main lobe centre (DK=0), this is because the energy decreases in the timedomain after windowing.

3.3.

From equation (22) we can obtain the phase factor to the Hanning window as

ejv/2 · e−jNv/2 = e−j(N−1)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 different but while Dc is restrainedin domain [−p, p], there is no difference.

4. EXAMPLE

Produce the function shown in equation (33) by the use of a computer. With samplingfrequency 1024 Hz, and carrying out FFT (1024 points) the frequency interval is 1 Hz, theprecise amplitude of one-side of the amplitude spectrum is 1. This makes it easy to observethe corrected errors.

Y=z2 cos (2p123.2t+10p/180)+z2 cos (2p143.4t+20p/180)

+z2 cos (2p385.7t+30p/180). (33)

Page 8: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

. . 218

T 1

Multi-frequency signal spectrum analysis results (when using Hanning window, the recoverycoefficient 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.06143.0 0.750533 92.22 143.0 0.901542 91.93386.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 spectrum analysis result of equation (33) without correction, it is obvious thatthe analysis error is larger. Taking the frequency component 386.7 Hz as an example, wecan see that the amplitude error is 14.1%, the frequency error is 0.3 Hz and the phase erroris 54.18°.

Substituting the spectrum components 385 Hz, 386 Hz and their correspondingamplitudes 0.368611 and 0.85947 V into equations (12), (13), (15) and (20), we can obtainthe corrected results as follows

DK=−Yk−1

Yk +Yk−1=

−0.3686110.368611+0.85947

=−0.300152.

The corrected frequency is

f=(K+DK)fs

N=386+(−0.300152)=385.699848.

The corrected amplitude is

A=pDKYk

sin (pDK)=

3.1415926× (−0.300152)×0.859470sin [3.1415926× (−0.300152)]

=1.001414.

The corrected phase is

uk =tg−1 0 Ik

Rk1−DKp=tg−1 0−0.3520200.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 phaseerror is 0.15°, it can be clearly seen that the spectrum precision has been improved greatly.

Page 9: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

219

By using a similar method we obtain Table 1 ,which shows the corrected results and the erroranalysis of a multi-frequency signal spectrum.

Figure 7 is the frequency spectrum analysis result of equation (33) using the Hanningwindow, the amplitude error is smaller than when using a rectangular window. Taking thefrequency component 386.7 Hz as an example, we can see the amplitude error is 5.84%, thefrequency error is 0.3 Hz and the phase error is 54.14°.

Substituting the spectrum components 385 and 386 Hz and their correspondent amplitude0.724560 and 0.941596 V into equations (28), (13), (30) and (20), we can obtain the correctedresults as follows

DK=Yk −2Yk−1

Yk +Yk−1=

0.941596−2×0.7245600.941596+0.724560

=−0.304608.

The corrected frequency is

f=(K+DK)fs

N=386+(−0.304608)=385.6954 Hz.

The corrected amplitude is

A=pDKYk

sin (pDK)· 2(1−DK2)=

−p×0.304608×0.941596sin (−p×0.304608)

×2×(1−0.3046082)=1.000021.

The corrected phase is

uk =tg−1 0 Ik

Rk1−DKp=tg−1 0−0.057182−0.1298521 180

p−(−0.304608 ( 180)=30.6964°.

After correction, the amplitude error is 0.02-, the frequency error is 0.0045 Hz, the phaseerror is 0.6964°. Compared with the rectangular window the amplitude error is smaller. Byusing a similar method we obtain Table 2, which shows the corrected results and the erroranalysis of a multi-frequency signal spectrum. When the interval between the two spectrais smaller, the correction precision of the Hanning window is better than that of therectangular window.

When frequency intervals are sufficiently large (such as the frequency component 385.7 Hzin this example) we can obtain higher correction accuracy using either the rectangular

T 2

Multi-frequency spectrum analysis correction results

Windowfunction CF (Hz) FAE CA AAE CP (°) PAE

Rectangular 123.1893 1.07×10−2 1.005757 −5.757×10−3 12.3870 −2.3870window 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.151Hanning 123.2001 1.0×10−4 1.000016 −1.6×10−5 10.0475 −0.0475window 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.

Page 10: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

. . 220

window or the Hanning window. At this time the absolute errors of frequency and amplitudeare about 1- and the phase error is also small. The nearer the two frequencies are, the lowerthe correction is. In the former example, 123.2 and 143.4 Hz are separated by 20 spectrallines, the correction errors of the frequency and amplitude are obviously larger. Thefrequency error increases from 1- to 1%and the phase error is also larger. According totheory this correction method should not be used if the frequency interval is less than fourtimes that of the frequency resolution ratio as the frequency spectrum main lobe will overlap.

5. CONCLUSION

Correction techniques for frequency, amplitude and phase in spectrum analysis cangreatly increase the accuracy of discrete spectrum analysis. They have solved the problemof obtaining high precision frequency and amplitude, both in theory and practice, and alsodeveloped a useful technique to measure signal parameters precisely. This technique ischaracterised by a simple algorithm and high calculation speed. The shortcomings are thatonly two very useful window functions have been used, although there are many kinds, andthat the technique is not suitable for analysis where the frequency is very concentrated.

REFERENCES

1. E. O. B 1984 Fast Fourier Transform (FFT), pp. 110–119. Shanghai: Shanghai Scienceand Technology Publishing.

2. Z S, 1982 Fast Fourier Transform (FFT) and Its Application, pp. 218–221. Beijing:Post and Telecommunications Publishing House of the People.

3. C H 1990 Practical Signal Processing Technique of Fast Fourier Transform (FFT),pp. 68–73. Beijing: Oceans Publishing House.

4. H D 1995 Mechanical Systems and Signal Processing 9, 113–118. Phase error in fastFourier transform analysis.

APPENDIX A: NOMENCLATURE

Dv frequency intervalN point numbers of sequence analysedn point no. of sequence analysed (n=0, 1, 2, . . . , N−1)fs sampling frequencyW(n) window functionf frequency (or corrected frequency)v frequency (v=2pf)W(v) frequency spectrum function of windowW0(v) modulus of window frequency spectrum functionK no. of spectrum linesX no. of spectrum lines (X is not always integer)W0(v), Y, f(X) modulus of window discrete frequency spectrum functionX0 the abscissa of the main lobe barycentreDK correction of spectrum linesA the corrected amplitude of the signal analysedc phase angle of window frequency spectrum functionDc correction of cuk the corrected phase angle functionD(v) Dirichlet kernel

Page 11: Corrections for Frequency, Amplitude and Phase in a Fast Fourier Transform of a Harmonic Signal

221

APPENDIX B

Huang Dishan [4], has recently published a paper on this topic. Our work differs in thatthe present paper is based on discrete frequency spectrum analysis. Using the barycentremethod, the paper commences with frequency correction and then covers amplitude andphase correction. All of the equations use discrete formulae and the deduction of the phasecorrection is therefore very concise. The correction techniques presented in this paper canbe used for rectangular and Hanning windows. Huang Dishan commences with phasecorrection and then covers frequency and amplitude correction. As most of the solutionsare based on the continuous frequency spectrum the problem increases in complexity andis only suitable for the correction of rectangular windows.