32.2 KB · commit a9602da
The approximation of a function by means of Fourier series, i.e., by a series of sines and cosines, is found useful in applications involving oscillating or vibrating systems. Let the function f(t) be a periodic function with period T>0, i.e., let f(t+T)=f(t),(4.67) where T is the smallest value satisfying Eq. (4.67). Then the Fourier series for f(t) is written as f(t)=2a0+n=1∑∞(ancosT2πnt+bnsinT2πnt),(4.68) where an and bn are real numbers independent of t and ω0=2π/T is called the fundamental frequency. The coefficients 2πk/T, k=2,3,… are called harmonics.
Integrating both the sides of Eq. (4.68) from 0 to T, we obtain ∫0Tf(t)dt=2a0∫0Tdt+∫0T(ancosT2πnt+bnsinT2πnt)dt=2a0T,
since ∫0Tcos(T2πnt)dt=∫0Tsin(T2πnt)dt=0. Hence a0=T2∫0Tf(t)dt.(4.69) Again, multiplying both the sides of Eq. (4.68) by cos(2πnt/T) and then integrating from 0 to T, we get an=T2∫0Tf(t)cos(T2πnt)dt,(4.70) since ∫0Tcos(T2πnt)sin(T2πnt)dt=0. Finally, multiplying both the sides of Eq. (4.68) by sin(2πnt/T) and then integrating from 0 to T, we obtain bn=T2∫0Tf(t)sin(T2πnt)dt.(4.71) Thus the coefficients a0, an and bn in the representation (4.68) are evaluated. If T=2π, i.e. if f(t) is of period 2π, Eqs. (4.69)–(4.71) become:
a0anbn=π1∫−ππf(t)dt,=π1∫−ππf(t)cosntdt,=π1∫−ππf(t)sinntdt.⎭⎬⎫(4.72)The Fourier series becomes further simplified if f(t) is an even or odd function. If f(t) is even, then we have
f(t)wherean=2a0+n=1∑∞ancosnt,=π2∫0πf(t)cosntdt,⎭⎬⎫(4.73)since bn=0.
Similarly, if f(t) is an odd function, then we have
f(t)wherebn=n=1∑∞bnsinnt,=π2∫0πf(t)sinntdt.⎭⎬⎫(4.74)since a0=an=0.
The formulae (4.68)–(4.71) can be expressed in a different way. For this, the well-known relations are used: cosnt=2eint+e−intandsinnt=2ieint−e−int.(4.75) Using Eq. (4.75), Eqs. (4.68)–(4.71) can be expressed as f(t)=p=−∞∑∞Ape2πipt/T,(4.76) where Ap=T1∫−T/2T/2f(t)e−2πipt/Tdt,p=0,1,2,…(4.77) These formulae directly lead us to the discussion of Fourier transforms but, before this, we consider an illustrative example on Fourier series.
We, therefore, have f(t)=n=1∑∞bnsinnt, where
bn=π2∫0πf(t)sinntdt=π2∫0πsinntdt,since f(t)=1=π2[−n1cosnt]0π=nπ2[1−(−1)n]=nπ4,n=1,3,5,…It follows that f(t)=n=1,3,5,…∑∞nπ4sinnt=π4(sint+31sin3t+51sin5t+⋯). ◀
In the preceding section, we considered the Fourier series for periodic functions. There exist, however, several functions which are not periodic. Similarly, we come across, in nature, many phenomena (for example, lightning) which are aperiodic. The study of such phenomena is of great importance to the engineer. In such cases, the Fourier transform is the applicable tool and this can be derived, from Eqs. (4.76) and (4.77), by making T approach infinity so that the function becomes aperiodic. When T→∞, Eq. (4.77) can be written in the form F(iω0)=∫−∞∞f(t)e−iω0tdt,(4.78) and is called the Fourier transform of f(t). Similarly, Eq. (4.76) is written as f(t)=2π1∫−∞∞F(iω0)eiω0tdω0,(4.79) and is called the inverse Fourier transform of f(t). Equations (4.78) and (4.79) enable us to transform from time domain to frequency domain and from frequency to time domain, respectively. Physically, F(iω0) represents the frequency content of the signal. In Eq. (4.78), the function f(t) is given in the continuous form which is rarely the case with a signal. In fact, the function
f(t) is available only in a discrete form. In such a case, discrete analogues of both the integrals are used to compute the transforms. These equations, called the Discrete Fourier Transforms, are discussed below.
Let f(t) be specified at the points ti, i=0,1,2,…,N−1, and Δt=NT. If fk denotes the value of f(t) at t=tk, then the discrete Fourier transform (DFT) and the inverse discrete Fourier transform (IDFT) are defined by Fp=k=0∑N−1fk⋅e−2πikp/N,p=0,1,2,…,N−1(4.80) and fk=N1p=0∑N−1Fp⋅e2πikp/N,k=0,1,2,…,N−1(4.81) Denoting WN=e−2πi/N,(4.82) Equations (4.80) and (4.81) become Fp=k=0∑N−1fk⋅WNkp,p=0,1,2,…,N−1(4.83) and fk=N1p=0∑N−1Fp⋅WN−kp,k=0,1,2,…,N−1(4.84) The above equations are, respectively, called the discrete Fourier transform (DFT) and the inverse DFT. The coefficients ∣Fp∣ form a periodic sequence when extended outside of the range p=0,1,2,…,N−1, and we have Fp+N=Fp(4.85) From Eq. (4.83), it may be seen that to compute each point of the DFT, we have to perform N complex multiplications and (N−1) complex additions. Hence the N-point DFT requires N2 complex multiplications and N(N−1) complex additions.
(i) Symmetric property WNk+2N=WNk⋅WNN/2=−WNk,since WNN/2=e−2πi2NN=e−πi=−1.
(ii) Periodic property WNk+N=WNk⋅WNN=WNk,since WNN=e−2πiN/N=e−2πi=1.
(iii) Another useful property WN2=e−2πi2/N=e−4πi/N and WN/2=e−2πi/(N/2)=e−4πi/N Hence WN/2=WN2.
A useful analysis that is important in the practical applications of Fourier transform (such as smoothing of noisy data) is called the power spectrum which is a plot of the power versus frequency. If f(t) is a discrete time signal with period N, then the power P is defined by the relation P=N1k=0∑N−1∣Fk∣2=k=0∑N−1∣fk∣2(4.86) Therefore, the sequence Pk=∣fk∣2,k=0,1,2,…,N−1(4.87) is the distribution of power as a function of frequency and is called the power density spectrum of the periodic signal. Since Fk is a periodic sequence with period N, it follows that the spectrum of Fk (k=0,1,2,…,N−1) is also a periodic sequence with period N.
We have
F(p)=k=0∑N−1fkWNkp,p=0,1,2,…,N−1.=f0+f1WNp+f2WN2p+⋯+fN−1WN(N−1)p,p=0,1,…,N−1.Putting p=0,1,2,…,N−1, in the above equation, we obtain
F0F1FN−1=f0+f1WN0+f2WN0+⋯+fN−1WN0=f0+f1WN1+f2WN2+⋯+fN−1WNN−1⋮⋮=f0+f1WNN−1+f2WN2(N−1)+⋯+fN−1WN(N−1)(N−1)The preceding can be expressed in the matrix form: F0F1⋮FN−1=11⋮11WN1⋮WNN−11WN2⋮WN2(N−1)⋯⋯⋯1WNN−1⋮WN(N−1)(N−1)f0f1⋮fN−1(4.88) or [F]=[WN][f] In a similar way, Eq. (4.84) can be expressed as [f]=N1[WN∗][F],(4.89) where WN∗ is the complex conjugate of WN.
For N=4, [Wn]=11111−i−1i1−11−11i−1−i Therefore, [WN∗]=11111i−1−i1−11−11−i−1i Hence
[f]=4111111i−1−i1−11−11−i−1i11−i−11+i=4124−20=0.51.0−0.50◀
For p=1,2,3,…,N−1, Fp=0. For p=0, Fp is of the form 00. By L'Hospital's rule, we obtain F0=2p→0lim1−e−2πip/N1−e−2πip=2N. Hence Fp={2N,0,p=0p=1,2,3,…,N−1 ◀
The computation of DFT by formula (4.83) requires N2 complex multiplications and N(N−1) complex additions. It also requires memory to store the values of f(t) and WNkp. Besides, it does not make use of the periodic and symmetric properties of WNkp. As N increases, the computation of DFT demands very high memory requirements and becomes a time-consuming process.
The Fast Fourier Transform (FFT) algorithms make use of the symmetric and periodic properties of WNkp and compute the DFT in an economic fashion. It requires Nlog2N operations, which means that in terms of computing time and memory requirements, the FFT is far superior to the DFT. For N=50, for example, the FFT requires about 250 complex operations compared to about 2500 complex operations required by the direct use of Eq. (4.83).
There exist several FFT algorithms and the basic idea behind all these is that a DFT of length N is decimated (or split) into successive smaller DFT's. One class of algorithms, called radix-2 algorithms, assume that N is a power of 2. The decimation is carried out in either the time domain or frequency domain. Accordingly, we have two types of algorithms in this class, namely, (a) decimation-in-time (DIT) and (b) Decimation-in-frequency (DIF). The Cooley–Tukey algorithm belongs to the type (a), whereas, the Sande–Tukey algorithm to the type (b). Both the algorithms require Nlog2N operations and the Cooley–Tukey algorithm is discussed in the next section.
This algorithm assumes that N is an integral power of 2, i.e., N=2m, where m is an integer. The basic idea of this algorithm is to decompose the N-point DFT into two N/2-point DFT's then decompose each of the N/2-point DFT's into two N/4-point DFT's and continuing this process until we obtain N/2 two-point DFT's. It is clear that we require m steps to achieve this.
To describe the algorithm, we first consider the case N=4, i.e., m=2. Let f0,f1,f2,f3 be the sequence of values of f(t). The DFT for fk is given by Fp=k=0∑3fkW4pk,p=0,1,2,3.(4.90) where W4=e−2πi/4=−i We split the sum on the right side of Eq. (4.90) into two equal parts of length 2, one containing the even-indexed values of f(t) and the other, the odd-indexed values. We, therefore, write Fp=k=0,2∑fkW4kp+k=1,3∑fkW4kp(4.91) Putting k=2r in the first sum and k=2r+1 in the second sum of Eq. (4.91), we obtain
Fp=r=0∑1f2rW42rp+r=0∑1f2r+1W4(2r+1)p=r=0∑1f2rW2rp+W4pr=0∑1f2r+1W2rp,p=0,1It may be seen that the first sum consists of f0 and f2 (even-indexed values) and the second sum f1 and f3 (odd-indexed values). A convenient notation is to use the superscripts e and o for the first and second sums, respectively*. We therefore write Fp=Fpe+W4pFpo,p=0,1(4.92) where
FpeandFpo=r=0∑1f2rW2rp=r=0∑1f2r+1W2rp⎭⎬⎫p=0,1(4.93)Since Fp is periodic with period 2, we have
Fp+2=Fpe+W4p+2Fpo,p=0,1=Fpe−W4pFpo,p=0,1(4.94)* Numerical Recipes in FORTRAN, CUP, Indian edition [1994].
since W42=−1. From Eqs. (4.92) and (4.94), we obtain
F0F1F2F3=f0+f2+f1+f3=f0−f2−i(f1−f3)=f0+f2−(f1+f3)=f0−f2+i(f1−f3)⎭⎬⎫(4.95)Results of Example 4.16 follow easily from Eqs. (4.95).
The computations involving Eqs. (4.92) and (4.94) of the 4-point DIT–FFT are shown in Fig. 4.3 called flow-graph.
Figure 4.3 Flow-graph for DIT–FFT, N=4.
We next consider the case N=8. Let the sequence of values of f(t) be fk={f0,f1,f2,f3,…,f7}. The DFT for fk is Fp=k=0∑7fkW8pk,p=0,1,2,…,7, where W8=e−2πi/8 Splitting the 8-point DFT into two equal parts of length 4, one containing the even-indexed fk and the other of the odd-indexed fk, we write Fp=Fpe+W8pFpo(4.96) where
FpeandFpo=r=0∑3f2rW4rp=r=0∑3f2r+1W4rp⎭⎬⎫p=0,1,2,3(4.97)Using the periodic properties, we also have
Fp+4=Fpe+W8p+4Fpo,p=0,1,2,3=Fpe+W8p⋅W84Fpo=Fpe−W8pFpo,p=0,1,2,3(4.98)since W84=W21=−1. It may be seen that Fpe and Fpo are both 4-point DFT's. This completes the first stage of the decimation process and the computations are shown in the flow-graph in Fig. 4.4.
Figure 4.4 Flow-graph of first stage of 8-point DIT–FFT.
In Fig. 4.4, values of the factor W8kp are given below.
W80W84=1,=−1,W81W85=21−i,=2−1+i,W82W86=−i,=i,W83W87=−21+i,=21+i⎭⎬⎫(4.99)In the second stage of decimation, each of the 4-point DFT's in Fig. 4.4 is split into two 2-point DFT's. We then write
Fpe=r=0∑3f2rW4pr=s=0∑1f4sW2sp+W4ps=0∑1f4s+2W2sp=Fpee+W4p⋅Fpeo,(4.100)where
FpeeandFpeo=s=0∑1f4sW2sp=s=0∑1f4s+2W2sp⎭⎬⎫(4.101)Similarly, we obtain Fpo=Fpoe+W4pFpoo(4.102) where
FpoeandFpoo=l=0∑1f4l+1W2lp=l=0∑1f4l+3W2lp⎭⎬⎫p=0,1(4.103)Using the periodic properties, we also have Fp+2e=Fpee+W4p+2Fpeo,p=0,1.(4.104) and Fp+2o=Fpoe+W4p+2Fpoo,p=0,1.(4.105) This completes the second stage of decimation where each of the 4-point transforms is broken into two 2-point transforms. The flow-graph of the second stage is shown in Fig. 4.5.
Figure 4.5 Second stage of the decomposition.
From Eq. (4.101), we find
Fpee=s=0∑1f4sW2sp,p=0,1=f0+f4W2pand
Fpeo=s=0∑1f4s+2W2sp,p=0,1=f2+f6W2p,p=0,1It follows that at the third stage of decimation, we obtain Fpeee=f0,Fpeeo=f4,Fpeoe=f2andFpeoo=f6. Thus, for the 8-point DFT, we start with the input sequence f0,f4,f2,f6,f1,f5,f3 and f7, and obtain the output in the natural order, i.e., F0,F1,F2,F3,F4,F5,F6 and F7.
The three stages of computation can be shown in a single flow-graph (Fig. 4.6).
Figure 4.6 Flow-graph of an 8-point DIT–FFT.
From Fig. 4.6, the following observations can be made (i) The input is in the bit-reversed order, namely f0,f4,f2,f6,f1,f5,f3,f7, as shown in Table 4.2.
Table 4.2 Input Data in the Reversed Bits
| Input position | Binary digits | Reversed bits | Index of the sequence |
|---|---|---|---|
| 0 | 000 | 000 | 0 |
| 1 | 001 | 100 | 4 |
| 2 | 010 | 010 | 2 |
| 3 | 011 | 110 | 6 |
| 4 | 100 | 001 | 1 |
| 5 | 101 | 101 | 5 |
| 6 | 110 | 011 | 3 |
| 7 | 111 | 111 | 7 |
(ii) The output for the Fourier coefficients Fk is in the natural order. (iii) Computations are carried out in terms of what is called a butterfly. A typical butterfly is shown in Fig. 4.7.
Figure 4.7 A typical butterfly.
The flow-graph for this computation is shown in Fig. 4.8.
Figure 4.8 Flow-graph for Example 4.19.
where,
W80W84=1,=−1,W81W85=21−i,=−21−i,W82W86=−i,=i,W83W87=−21+i,=21+i.From these equations, we obtain
F0F1F2F3F4F5F6F7=F0e+F0o=20,=F1e+W81F1o=−3−i+21−i(−1−3i)=−5.828−i(2.414),=0,=−3+i−2(1+i)(−1+3i)=−0.172−i(0.414),=0,=−3−i−2(1−i)(−1−3i)=−0.172+i(0.414),=0,=−3+i+2(1+i)(−1+3i)=−5.828+i(2.414).The flow-graph for this computation is given in Fig. 4.9.
Figure 4.9 Flow-graph for Example 4.20.
◀
This alternative approach is a member of the class of algorithms called decimation-in-frequency techniques. It is the reverse of the Cooley–Tukey algorithm described in the previous section. In this case, the output is in the bit-reversed order.
To start with we take N=4, i.e., fk={f0,f1,f2,f3}. Then we have Fp=k=0∑3fkW4pk,p=0,1,2,3 In the method, the above sum is divided in terms of the first two and last two points as:
Fp=k=0,1∑fkW4pk+k=2,3∑fkW4pk=k=0∑1fkW4pk+k=0∑1fk+2W4p(k+2);p=0,1,2,3(4.106)Now, W4p(k+2)=W4pk⋅W42p=W4pk(−1)p, since W42p=W2p=(−1)p. Hence, Eq. (4.106) becomes Fp=k=0∑1[fk+(−1)p⋅fk+2]W4pk,p=0,1,2,3(4.107) which consists of both even and odd components.
Let Fp=F2r+F2r+1, where
F2randF2r+1=k=0∑1(fk+fk+2)W42rk=k=0∑1(fk+fk+2)W2rk=k=0∑1(fk−fk+2)W4k(2r+1)=k=0∑1(fk−fk+2)W42kr⋅W4k=k=0∑1(fk−fk+2)W2kr⋅W4k,r=0,1⎭⎬⎫(4.108)We define
gkandhk=fk+fk+2=(fk−fk+2)W4k}(4.109)Then
F2randF2r+1=k=0∑1gkW2rk,r=0,1=k=0∑1hkW2rk,r=0,1⎭⎬⎫(4.110)It can be seen that the output is in the order F0,F2,F1 and F3. We now consider the case N=8. Let fk={f0,f1,f2,f3,f4,f5,f6,f7}. Then Fp=k=0∑7fkW8pk,p=0,1,…,7. We split the above sum in terms of the first four and last four points as
Fp=k=0,1,2,3∑fkW8pk+k=4,5,6,7∑fkW8pk=k=0,1,2,3∑fkW8pk+k=0,1,2,3∑fk+4W8p(k+4)(4.111)Now, W8p(k+4)=W8pk⋅W84p=(−1)pW8pk Hence Eq. (4.111) becomes Fp=k=0∑3[fk+(−1)pfk+4]W8pk,p=0,1,…,7.(4.112) Since the right side of Eq. (4.112) consists of both even and odd Fourier coefficients, we write Fp=F2r+F2r+1,
where
F2randF2r+1=k=0∑3[fk+fk+4]W82rk=k=0∑3[fk+fk+4]W4rk,r=0,1,2,3=k=0∑3[fk−fk+4]W8k(2r+1),=k=0∑3[fk−fk+4]W4rk⋅W8k,r=0,1,2,3⎭⎬⎫(4.113)For brevity, let
fk+fk+4andW8k(fk−fk+4)=gk=hk},k=0,1,2,3(4.114)Then Eq. (4.113) becomes
F2randF2r+1=k=0∑3gkW4rk=k=0∑3hkW4rk⎭⎬⎫,r=0,1,2,3(4.115)The flow-graph for the first stage of this algorithm is given in Fig. 4.10.
Figure 4.10 Flow-graph for the first stage of Sande–Tukey algorithm.
Clearly, this approach can be repeated at the second stage to split each of the 4-point DFT's into two 2-point transforms. Flow-graph for this computation is shown in Fig. 4.11.
Figure 4.11 Second stage for Sande–Tukey algorithm.
In the general case, the final result is obtained after log2N stages. Figure 4.12 shows the flow-graph for the 8-point decimation in frequency FFT.
Figure 4.12 8-point flow-graph for Sande–Tukey algorithm.
We observe that the input is in the natural order, whereas the output for the frequency components is in the bit-reversed order.
The inverse DFT is defined by fk=N1p=0∑N−1FpWN−kp,k=0,1,…,N−1. Comparison with DFT shows that the factors WNkp have changed signs, the input and output have interchanged, and that the final output is divided by N. Hence the flow-graph for the calculation of DFT can also be adopted for the computation of inverse DFT after making the above changes.
The flow-graph for this computation is shown in Fig. 4.13.
Figure 4.13 Flow-graph for Example 4.21.
Finally,
F0F2F1F5F3F7=p0+p1=20,=q0+q1=0,=−3−i−22−i2=−5.828−i(2.414)=−3−i+22+i2=−0.172+i(0.414)=v0+v1=−0.172−i(0.414)=v0−v1=−5.828+i(2.414)F4F6=p0−p1=0,=q0−q1=0,◀