advertisement

The art of signal processing Alex Townsend April 28, 2015 Signal processing relies on the FFT. That top-ten algorithm again. The task is to sample a signal: f (t) = ∞ X n=0 An |{z} ±amplitude cos(2π |{z} n t + an ), |{z} frequency phase and recover the amplitude, frequency, and phase. We know from Nyquist’s sampling law that we must sample at least 2 times per wavelength. Nyquist’s sampling law: “To recover a signal it must be sampled at least two times per wavelength.” So if we take N samples, then we cannot hope to recover signals with frequency more than N/2 − 1. Thus, we determine/approximate An and an such that N/2−1 f (k/N ) = X An cos(2πnk/N + an ). n=0 Since cos(z) = (eiz + e−iz )/2, this is the discrete Fourier transform in disguise. (You may wish to skip the derivation below, like many signal processing engineers.) N/2−1 X N/2−1 An cos(2πnk/N + an ) = n=0 N/2−1 X 1 X 1 An ean i e2πink/N + An e−an i e−2πink/N 2 2 n=0 n=0 N/2−1 = N −1 X 1 X 1 An ean i e2πink/N + An−N/2 e−an−N/2 i e−2πi(n−N/2)k/N 2 2 n=0 n=N/2 N/2−1 = N −1 X 1 X 1 An ean i e2πink/N + AN −n−1 e−aN −n−1 i e2πik/N e2πikn/N 2 2 n=0 n=N/2 N/2−1 = X Bn e2πink/N , n=0 1 where ( Bn = 1 an i , 2 An e 1 an i 2πik/N e , 2 An e 0 ≤ n ≤ N/2 − 1, N/2 ≤ n ≤ N − 1. (1) Our task is to compute Bn from samples f (k/N ) and then to work out An and an . You will notice that N/2−1 f (k/N ) = X Bn e2πink/N , 0≤k ≤N −1 n=0 is not quite the DFT. There is a minus sign missing, and we want the inverse process: Bn from f (k/N ) not f (k/N ) from Bn . These two cancel each other out. It really is the FFT. I told you the FFT is like superman. So we take samples of our signal, f (k/N ), compute the FFT of them to get Bn , and then undo (1). We have amplitude = |An | = |2Bn e−an i | = 2|Bn |. The frequencies are the non-zero values of Bn . Lastly, we have Im(Bn ) −1 . phase = an = tan Re(Bn ) Do not apply the formula for an , unless Bn is nonzero. Warning: In MATLAB there is a scaling to take care of. Divide Bn by N after the FFT. What happens if the signal is composed of non-integer frequencies? For example, N/2−1 X f (k/N ) = An cos(2πωn k/N + an ). n=0 Then, you will need extra ideas such as zero padding and windowing. (See class notes for brief introduction.) 2