Chapter 5 Fourier Methods
Total Page:16
File Type:pdf, Size:1020Kb
Chapter Fourier metho ds Intro duction Of the many b o oks on Fourier metho ds those by Chateld Proakis and Manolakis and Blo omeld are particularly go o d Sinewaves and Samples Sines and cosines can b e understo o d in terms of the vertical and horizontal displace ment of a xed p oint on a rotating wheel the wheel has unit length and rotates anticlockwise The angle round the wheel is measured in degrees or radians for unit radius circles the circumference is radians tell us how much of the circum ference weve got If we go round the wheel a whole numb er of times we end up in the same place egcos cos cos Frequency f is the numb er of times round the wheel p er second Therefore given x cos f t x at t f f etc For x cos f t we get a head start lead of radians Negative frequencies may b e viewed as a wheel rotating clockwise instead of anticlo ckwise If we assume we have samples of the signal every T seconds and in total we have s N such samples then T is known as the sampling p erio d and F T is the s s s sampling frequency in Hertz Hz samples p er second The nth sample o ccurs at time tn nT nF The cosine of sampled data can b e written s s xn cos f tn When dealing with sampled signals it is imp ortant to note that some frequencies b ecome indistinguishable from others at a sampling frequency F the only unique s frequencies are in the range to F Hz Any frequencies outside this range b ecome s aliases of one of the unique frequencies For example if we sample at Hz then a Hz signal b ecomes indistinguishable from Signal Pro cessing Course WD Penny April 1 0.5 0 −0.5 −1 0 0.2 0.4 0.6 0.8 1 Figure Aliases The gure shows a Hz cosine wave and a Hz cosine wave as solid curves At sampling times given by the dotted lines which correspond to a sampling frequency of Hz the H z signal is an alias of the Hz signal Other aliases are given by equation a Hz signal This is shown in gure More generally if f is a unique frequency 0 then its aliases have frequencies given by f f k F 0 s where k is any p ositive or negative integer eg for f and F the two lowest 0 s frequency aliases given by k and k are Hz and Hz Because of aliasing we must b e careful when we interpret the results of sp ectral analysis This is discussed more at the end of the lecture Sinusoidal mo dels If our time series has a p erio dic comp onent in it we might think ab out mo delling it with the equation xn R R cos f tn en 0 where R is the oset eg mean value of xn R is the amplitude of the sine wave f 0 is the frequency and is the phase What our mo del do esnt explain will b e soaked up in the error term en Because of the trig identity cos A B cos A cos B sin A sin B the mo del can b e written in an alternative form xn R a cos f tn b sin f tn en 0 Signal Pro cessing Course WD Penny April where a R cos and b R sin This is the form we consider for subsequent analysis This typ e of mo del is similar to a class of mo dels in statistics called Generalised Linear Models GLIMS They p erform nonlinear regression by rst taking xed nonlinear functions of the inputs these functions b eing called basis functions and second form an output by taking a linear combination of the basis function outputs In sinusoidal mo dels the basis functions are sines and cosines In statistics a much broader class of functions is considered However sinewaves have some nice prop erties as we shall see Fitting the mo del T T T If we let x x x xN w R a b e e e e and 0 1 2 N cos f t sin f t cos f t sin f t cos f t sin f t A cos f tN sin f tN then the mo del can b e written in the matrix form x Aw e which is in the standard form of a multivariate linear regression problem The solution is therefore T 1 T w A A A x But sinewaves are orthogonal Because we are dealing with sinewaves it turns out that the ab ove solution simpli es We restrict ourselves to a frequency f which is an integer multiple of the base p frequency f pF p b where p N and F s f b N eg for F and N seconds worth of data f H z and we can have s b 1 f from Hz up to Hz The orthogonality of sinewaves is expressed in the following p equations N N X X sin f tn cos f tn k k n=1 n=1 1 To keep things simple we dont allow f where p N if we did allow it wed get N and in p equations and for the case k l Also we must have N even Signal Pro cessing Course WD Penny April 1 1 0.5 0.5 0 0 −0.5 −0.5 −1 −1 0 0.2 0.4 0.6 0.8 1 0 20 40 60 80 100 a b Figure Orthogonality of sinewaves Figure a shows cos f tn and b cos f tn cosines which are and times the base frequency f H z For b b P N cos f tncos f tn This can be any two integer multiples k l we get k l n=1 seen from Figure b which shows the product cos f tncos f tn Because of b b the trig identity cosAcosB cosA B cosA B this looks like a Hz signal superimposed on a Hz signal The sum of this signal over a whole number of cycles can be seen to be zero because each cos term sums to zero If however k or l are not integers the product does not sum to zero and the orthogonality breaks down N X cos f tn sin f tn k l n=1 N X cos f tn sin f tn k l n=1 N X k l cos f tn cos f tn k l N k l n=1 N X k l sin f tn sin f tn k l N k l n=1 These results can b e proved by various trig identities or more simply by converting to complex exp onentials see or later in this chapter The results dep end on the fact that all frequencies that app ear in the ab ove sums are integer multiples of the base frequency see gure This prop erty of sinewaves leads to the result T A A D where D is a diagonal matrix The rst entry is N from the inner pro duct of two columns of s of length N the s are the co ecients of the constant term R and 0 all the other entries are N A matrix Q for which T Q Q D is said to b e orthogonal Therefore our A matrix is orthogonal This greatly simplies the tting of the mo del which now reduces to 1 T w D A x Signal Pro cessing Course WD Penny April 160 140 120 100 80 60 40 20 0 1730 1740 1750 1760 1770 1780 1790 Figure Sunspot index solid line and prediction of it from a simple sinusoidal model dotted line which is simply a projection of the signal onto the basis matrix with some prefactor 1 D rememb er the inverse of a diagonal matrix is simply the inverse of each of T the diagonal terms so this is easy to compute Given that w a b R we can 0 see that for example a is computed by simply pro jecting the data onto the second column of the matrix A eg N X cos f tx a t N n=1 Similarly N X b sin f tx t N n=1 N X x R t 0 N n=1 We applied the simple sinusoidal mo del to a sunsp ot data set as follows We chose samples b etween the years and b ecause there was a fairly steady mean level in this p erio d The sampling rate F Year This gives a base frequency of s f We chose our frequency f pf with p giving a complete cycle once b b every ten years This gave rise to the following estimates R a and 0 b The data and predictions are shown in Figure Signal Pro cessing Course WD Penny April Fourier Series We might consider that our signal consists of lots of p erio dic comp onents in which case the multiple sinusoidal model would b e more appropriate p X xt R R cos f t e 0 k k k t k =1 where there are p sinusoids with dierent frequencies and phases In a discrete Fourier series there are p N such sinusoids having frequencies k F s f k N where k N and F is the sampling frequency Thus the frequencies range from s F N up to F The Fourier series expansion of the signal xt is s s N 2 X xt R R cos f t 0 k k k k =1 Notice that there is no noise term Because of the trig identity cos A B cos A cos B sin A sin B this can b e written in the form N 2 X xt a a cos f t b sin f t 0 k k k k k =1 2 2 2 where a R cos and b R sin Alternatively we have R a b k k k k k k k k k 1 and tan b a The signal at frequency f is known as the k th harmonic k k k Equivalently we can write the nth sample as N 2 X xn a a cos f tn b sin f tn 0 k k k k k =1 where tn nT s The imp ortant things to note ab out the sinusoids in a Fourier series are i the frequencies are equal ly spread out ii there are N of them where N is the numb er of samples iii Given F and N the frequencies are xed Also note that in the s Fourier series mo del there is no noise The Fourier series aims to represent the data 2 perfectly which it can do due to the excessive numb er of basis functions The Fourier co ecients can b e computed by a generalisation of the pro cess used to compute the co ecients in the simple sinusoidal mo del N X cos f tnxn a k k N n=1 2 Statisticians would frown on tting a mo del with N co ecients to N data p oints as the estimates will b e very noisy the Fourier series is a low bias actually zero high variance mo del This underlines the fact that the Fourier metho ds are transforms rather than statistical mo dels Signal Pro cessing Course WD Penny April Similarly N X b sin f tnxn k k N n=1 N X a xn 0 N n=1 These equations can b e derived as follows To nd for example a multiply b oth k sides of equation by cos f tn and sum over n Due to the orthogonality k prop erty of sinusoids which still holds as all frequencies are integer multiples of a base frequency all terms on the right go to zero except for the one involving a This k just leaves a N on the right giving rise to the ab ove formula k Example The plots on the right of Figure show four comp onents in a Fourier series expan sion