 In this class, we will talk about FFT analysis which is fast Fourier transform analysis or FFT in brief. Like in the last class, we have seen that we have been able to store this digitally acquired data on the computer's RAM memory. So, from here how do we estimate or analyze the signal to find out its frequency components and that is what we will do. Well, to briefly review, we had discussed this in the past that even before FFT analysis was available, we could still estimate the frequency of the signal by signal filtering by having analog filters. It could be band pass filters, low pass filters. Now, we will talk about octave and one-third octave filters later on when we talk about audio signals. And then we had discussed about signal heterodyning wherein the phenomena of beat was taken into advantage to know the frequency of an unknown signal provided we have we know the frequency of a reference signal. And then orbit analysis using Lissa-Jose figure wherein we can compare the ratio frequency ratios of signals. And of course, mathematically if the function is periodic is mathematically describable, we could use the expansion of Fourier series as to find out the frequency content in the signal. For example, I should tell you when we do Fourier series though, we had find out this coefficients a naught, a n and b n. So, a naught is actually independent on frequency and this is known as the DC component of the signal or what is known as the mean component of the signal. But because of the limitations of Fourier series as if the signal could not may not be continuous, may not be periodic etcetera, we have the Fourier transform wherein Fourier transform can be in the forward direction from the time to the frequency domain Fourier transform. And if I have an inverse Fourier transform, I can get the time from the frequency domain. But this Fourier transform can be done mathematically because if you look at the signal x k, this is nothing but the digital representation of this transformation from the time to the frequency domain. I will explain you what this is because this is an equivalent of the Fourier transform. And if you look at this equation, the integration has been replaced by a summation sign. So, this can be very easily implemented in a computer and if the data, these are the x n is the digitally sampled time data, capital N is the number of data points digitally acquired. You know this n is what are specifying to the memory space in the a to d card. Small n is a time index which goes from n is equal to 0 to n minus 1. So, it covers all the n data points and k is similarly a small k is similarly a frequency index. So, this is in the time domain and this is the frequency components. So, let us see if you want to do this operations and these are complex numbers and these are complex in nature. So, a real world time domain data will have complex Fourier or frequency domain components. And this competition is complex. So, actually what happens if you look into this number of operations, there are actually in this DFT, discrete Fourier transform there are n square complex operations. But you know in I am talking about before the advancement of computers and you can understand to do n square complex operations, it was a Herculean task. You are talking about the year of 30s and 40s you know during the world war etcetera. How do you think people analyze signals? This is a very very difficult task. I will give you a brief history of Fourier analysis. So, actually in 1964 two gentlemen working in the IBM Research Center in New York known by gentlemen Cooley and Take they came up with an algorithm where n it was not n square complex operations, but n log to the base 10 of n operations to do DFT. And in those days you know computation was very expensive. So, but this when n n square is a parabola with n log n this is the n log n n square computation time or resources. So, this was a much faster way of doing the same DFT and this gave rise to a fast way of doing discrete Fourier transform. And this then came to known as the fast Fourier transform. In those days you know what event today you are you know the calculations you can do on your mobile for and on your calculator you are done in computers which are you know as big as this room. So, you can imagine the amount of computational effort required to do a Fourier analysis. Nowadays on your on your laptop if you do DFT or FFT you will hardly know the difference between the computation time and n could be as high as you know 10 to the power 12 or 10 to the power 14 it is not a problem. So, but in those days you know in 1964 not very far off, but then this was a problem. So, actually to give a little more history about this FFT. So, this Cooley and Tuckay once they came up with this algorithm the company and of which we know all the HP Hewlett and Packard they came up this that is what we have read in history that they hired Cooley and Tuckay and started selling FFT analyzer. So, having the Cooley and Tuckay algorithm in them. So, they left IBM and they joined HP, HP started marketing the FFT analyzers from the late 60s and they were very very popular event till few years ago, but nowadays you know we have you know chip based or card based FFT analyzers. Those days the FFT analyzers was size of steel aluminum mirror, large steel aluminum. Nowadays the FFT analyzers could be as small as your you know cigarette lighter and they will be much more powerful, because such has been the advancement in electronics that fast chips VLSI chips etcetera we can do this mathematical computations on the hardware very quickly and then come up with the FFT results. Well, so what is FFT? FFT is nothing but an efficient algorithm to do DFT, but what does FFT gave us is very important, because to begin with I have a block of sample data 0 and to n. So, I have n minus 1 to be precise I have this data's which are there on my I am denoting them by circles, because this is what I have obtained after my data has been sampled. So, this will corresponds to each of your x n and then I will have an such an array of n data points and all I need to do is I need to sample it at a time index, where n times delta t where delta t is the sampling interval. So, I will n is equal to 1 times delta t 2 times delta t 3 times delta t and then I will pick up all this successive values and plug it into the equation of DFT and do the operations using the either the n log n operations or the n square operations and come up with components which will be nothing but the Fourier components of such signal. So, if I was to now explain to in a block diagram I will have and I will get this is in time, this is in frequency and this is the FFT process. So, this is the digitally sampled data and this is the complex and this is usually a real data, it is not a complex number because real world signals are real not complex, but I will have a complex I will say Fourier or frequency components. So, X F being a complex I can represent as and this is in the frequency domain, but then I need to know what is the relationship between this time and frequency. For example, if I have n blocks of time data in the frequency domain what happens is 0 component it goes to n by 2 and may be n by 2 minus 1 etcetera. So, this component I will have n by 2 minus 1 etcetera. So, these components will almost be a mirror image mirror image and this is in the frequency and this is in the time domain. This could be sought in the negative frequency and this is in the positive frequency. For real world signals we actually discard this data we do not use this data. So, any n data point will have give us only n by 2 meaningful FFT results. Now, so how do we relate to the sampling frequency to the maximum frequency contained in the signal to the spectrum which we get in the frequency domain. I should tell you like we have time waveform where the X axis is the frequency we call anything as a spectrum where the X axis is the frequency. So, this complex numbers which we will get. So, the magnitude of this is nothing, but and then of course, there will be a phase between the real and imaginary. So, phase is nothing, but tangent inverse of a phase is also a function of frequency. So, I am denoting through a magnitude phase or real imaginary. Now, we will see before we see the relationship let us see what certain terminologies in this FFT mean and they all will relate to the my original FS because we all know what FS is the sampling frequency and we know how it was related to the feature it is a property of the data equation card and sampling interval related to this. If number of data points is n total time t is nothing, but n times delta t is nothing, but the time record length because I can I have to rather do FFT on a block of sample data. So, this is my block of sample data. So, this is maybe I will I can either start with 1 and n and then this distance between them is delta t total time here is n times delta t is equal to t this is n time domain. Now, once we do FFT this will be converted from the frequency domain and let us see if I was to plot the results of FFT. So, we put the amplitude of this and I am getting a plot like this wherein I have joined all the frequency components. So, there are all these individual frequency points I will not complete this, but so this is now not equal to delta t, but this is delta F and which is the frequency resolution. There is a very fundamental relationship between this frequency resolution and time. They are inversely related and the most important equation is this delta F is nothing, but 1 by capital T. I do it is not delta t, but capital T. So, the more the time you have a long time you can have very fine resolutions. You can imagine if I want to see frequencies every 0.1 hertz, 0.2 hertz, 0.3 hertz how much of time do I require. So, because delta F is equal to 1 by n delta t because t is equal to n times delta t. So, this is nothing, but sampling frequency by n. So, if my sampling frequency is fixed I can have only a lower resolution or improved resolution if my n is large. So, large amounts of data needs to be taken to have a finer details of the frequency and this is something you have to keep in mind while setting up your FFT analyzers to do the calculations. And then I hope this is clear to all of you and then this is very important here how the frequency resolution is related to the sampling frequency and number of data points. Now, as I was telling you once we have n data points we will have 1 going from minus n by 2 to n by 2. This is the negative frequencies which we discard. So, the maximum frequency in the F max or in the FFT will be from 0 to this is this value is only n by 2. So, the maximum frequency F max which we obtained in this frequency is nothing, but k times n by 2 and what is this k? I am sorry delta f times n by 2 with each one of them is delta f. Now, delta f is nothing, but f s by n times n by 2 that is equal to f s by 2. So, given a sampling frequency I can very well almost obtain half of it. So, when I am talking about an analyzing an audio signal in a out of a CD player coming out at 20 kilohertz I should sample at 40 kilohertz and above. And usually because of certain of this filters they have a roll off you know when I say a low pass frequency at f c, but because of this roll off some data comes through. So, usually we sample at a value of 2.56 times F max. So, if n is equal to 1024 data points in the time domain, we will have 512 points in the frequency domain of interest to us. We will discard the few points at the last. So, we will have what is known as when n is equal to 1024 n by 2 is 512, but we will take actual n is 400 and it is 2048 this will become 1024 this will become 800 and this are commercially known as lines of FFT. This means in my FFT analyzer I will only show you 800 or 400 or 200 data points. So, reference is an indirect way of telling that how much data I would have taken in my n. If it is 800 I would have taken 2048. So, nowadays there are analyzers wherein we can have up to 7200 lines of FFT. And this means 2048 blocks of data sorry data points in a block are taken and the FFT analysis done and the results displayed. Nowadays FFT analyzers I can either do it through the software given by that equation or even implement it in a hardware or where all this hardware competitions are done. FFT competitions also takes the time. Imagine I have taken a block of data of n points. So, I have to do FFT on this FFT takes some computation time. So, because if this is a continuous stream of data coming in I am taking blocks of data blocks of data. So, before I finish computing the FFT if more data comes I am going to either store I have to either store them otherwise I will lose the data. But if I can do the FFT complete the FFT before this second block of data comes I would have done what is known as the real time FFT. So, FFT competitions are done on the fly on the run quickly efficiently before the next block of data comes to my block and that is what is known as real time FFT. And then analyze the processing has to be very fast. Nowadays you know the computers are very fast. So, we can do it very quickly and then there are software which will guide you to you know suppose there will be a buffer management in the sense suppose you are taking more time. So, this will come and hold this data somewhere till your FFT is complete and so on. So, this kind of management is done in a software also. But now coming back to this FFT. So, maximum frequency which we can analyze is nothing, but f s by 2. Now how do we ensure that the FFT which we have done is correct. For example, let us take the case of a sine wave. So, for clarity I am drawing all the lines this is contained in such blocks of data and then I am having doing an FFT. So, if this was a pure tone signal in the FFT if I was just to plot the magnitude of this it has. So, I should be seeing one peak and this should be of 10 volt and the frequency corresponding to the frequency of the signal the magnitude of the signal. But you will see some instances what happens I will go into the specific details. For example, this is of a frequency of 23 hertz. So, I should be having a delta f and if I have taken delta f is nothing, but your f s by n is not it. So, if my f s is say 1000 hertz and I have taken n as 100 hertz. So, this is my delta f becomes 10 hertz. So, obviously, this computer is going to understand 0 hertz 10 hertz 30 hertz 40 hertz and so on. So, when it comes to 23 hertz it is lost like we had then the amplitude resolution case whether this is a 10 hertz signal I am sorry it will be 20 here also whether it is a 20 hertz signal or a 30 hertz signal. So, this is what is known as the picket fence that means I have inadequate frequency resolution in my signal. So, to overcome this I need to have my frequency resolution very very less that can be done by increasing the number of blocks of data number of lines of f f t same signal if you do an analysis with different blocks of data or lines of f f t you will sometimes get a sharp peak sometimes you will not get a sharp peak. So, whenever you are looking for unknown frequencies it is a good rule of thumb to have a final resolution. If you do not see any frequency spikes coming up you know you are not missing any signal otherwise you are going to miss a signal. So, when you use an f f t analysis that we have to be careful to play around with the signal change the setting see the number of blocks. How I can reduce the increase the block size of course, in increasing the block size means more time well and good, but then I should not be missing any frequencies. There are signals you know particularly when you have you know the space shuttle etcetera very massive bodies you know there will be natural frequency of the order of less than 1 hertz maybe 1 is having 0.7 hertz another is 0.09 hertz low frequencies at 2. So, distinct and closely spaced frequencies. So, if I get a vibration signal from a space shuttle I should be able to distinguish between 0.07 hertz and 0.09 hertz. So, this is a challenge to do. So, we have to have adequate frequency resolutions to ensure that this picket fence effect does not occur and we somehow miss the signal. This comes from the name of the English picket fence in the sense you know and if you have seen the English picket fence there are no white color pegs. People have it on the English side and there is the fencing. So, if I was to miss something if I was to hit a cricket ball cricket ball will pass if this fences are wide apart this pegs are wide apart, but I will catch it if it is they are close by. So, this is what is known as the picket fence effect in FFT. So, once we have a final resolution we are going to catch the signal. So, this is to be avoided by having adequate frequency resolution by increasing the number of data points. Another effect of the FFT is what is known as the leakage error and this has a serious effect in the amplitude estimation of the signal. For example, the FFT analysis it takes a block of data and it assumes that this blocks repeats itself assumes a periodicity because I have this data is coming I have started sampling the data I picked up the data and one it comes to end data points I stop it I clip it. Now, if my this data was a continuous sine wave. So, if I put few windows here sample the signal by this red blocks red boxes and you will see each one of this starts at a different starts and stops at a different amplitude location. For example, this has started here this has started here. So, this creates an amplitude discontinuity. Now, to avoid this discontinuity of what we do. So, there is what is known as a leakage in the frequencies. So, if my actual frequency is this the computer would estimate it is this because of leakage error. This is avoided if I multiply it with a function dot product because this is the sample data x if I multiply x with a windowing function wherein the window function looks something like this. So, at all the end points it multiplies them and makes them 0. So, this discontinues discontinuities are avoided by multiplying it with such a windowing function. So, that the leakage is reduced and then we will get a better estimate of the amplitude. So, with windowing I will get as close to the because you know here you see because of the leakage my right correct amplitude is given by this red signal x, but because of leakage I am getting this signal. So, this is a wrong estimation of the amplitude of the signal and sometimes also wrong estimation of the frequency because you do not know whether to take this frequency this frequency this frequency and so on. So, a wrong estimation of both frequency and amplitude is obtained because of such discontinuities because it assumes a periodicity. So, we multiply it with a windowing function to reduce this discontinuity, reduce the leakage and get a better estimate. There are many such mathematical windowing functions and I will write you the name of some of these mathematical functions. One is no window or this is a rectangular window handing is another very popular window and this is a flat top and there is an exponential window. Rectangular window is for it is actually a no window it is just a rectangular function and this is for a good frequency estimation of periodic signals, this is for a good amplitude estimation and then this is for removing transients. For example, in the fourth example suppose I have a signal wherein lot of oscillations are there. So, I could put an exponential window like this, this is used for for example, if I have excited a structure I want to see it is response, response would have died down because of damping I can reduce this ringing effect. So, that I bring it to 0 discontinuities are not removed or made to a minimum and for periodic signals we conventionally use either handing or flat top. If I want a good amplitude estimation of the signal I should use a flat top window in the FFT if I have to use a good estimation in fact, the correct estimation the frequency I should use a handing window. So, in the FFT process if I have taken care of this inadequate frequency resolution by having increasing the number of lines of FFT or increasing the block size I would be able to capture any unknown signal which would have otherwise would have missed. Another is to have a right estimation of either the frequency or the amplitude of the signal or windowing function has to be used. Now, this FFT which we have obtained can be either represented in the. So, this is a complex quantity this is the real quantity and then imaginary quantity this is the rectangular method of. So, I will have the real part of X F and then imaginary part of and you know how this F is related to nothing, but k times delta F per k is 0 to n by 2. k varies from 0 to n by 2 this is k is equal to 0 to n by 2. So, I will get the frequency spectrum both are really imaginary and then I can represent them in the polar form like by the magnitude and the theta. Now, what does this convey to us FFT physically what does it convey to us other than the frequency of the signal? This signal also carries certain information as to the energy contained in the signal as to the energy as a function of time as to the power of the signal. So, from the frequency after the FFT lot of post processing is done to the signal to analyze what other information we can obtain from the signal. So, let us see some of the signals some of the quantities which we can obtain from this FFT. So, if this FFT has been obtained I can obtain the linear spectrum magnitude of the linear spectrum is nothing, but so unit becomes linear and you will see magnitude means this is a real quantity and another quantity which we use is the auto spectrum or auto power spectrum of the signal sometimes power this means it is defined by this notation X capital S X X F is nothing, but the FFT of the signal multiply be careful this is a multiplication signal by it is complex quantity conjugate complex conjugate. So, this we will boil down to if I if I will not use the R I F notation. So, X R plus I X I times X R minus I X I. So, this will be nothing, but so you see though the FFT is complex the auto power spectrum is a real quantity and linear spectrum is nothing, but the square root of auto power spectrum it will be just the square root of this in which we have obtained here and mind you they are all functions of frequency. So, the auto power spectrum conveys how much of energy is there in that signal another related is the power spectral density. So, this is given by auto power spectrum by delta F. So, unit will be voltage square by say hertz and this is used to characterize random signal which are varying with time. So, linear spectrum will nothing, but the square root of power spectral density. So, this will be so this units will be voltage by square root of hertz. So, these are certain quantities which are can be very easily calculated from the after post processing the signals and this is just for one signal, but if there are two signals we can find out the correlations between them and how they are related to each other. And many of the FFT analyzers will have this availability at the push of a button even in the softwares, but we should understand what physically they mean. So, we started with the signal x t we have seen how we have sampled it got the blocks of data x n done FFT got x f from x f we have got s x x and then we have got the auto power spectrum. Now, let us see when there are two signals we will have what is known as the cross spectrum suppose I have two signals x t and y t and usually in a mechanical system this can be very easily related to suppose my input signal is x t output signal is y t and for a mechanical system to know the linear relationships between the stick to signals whether one is causing the other to see the causal relationship between the output and input I can look into many forms. One is the cross spectrum s x y as a function of f is defined as the auto spectrum of x multiplied by the complex conjugate of f and you will see that this is a complex quantity the power spectrum was real quantity, but the cross spectrum between two signals x and y is a complex quantity. So, if I was to find out the transfer function or the frequency response function f r f this is nothing but y of f by x of f in the frequency domain because y of f is a complex quantity x of f is a complex quantity. So, this is also a complex quantity. So, this will have magnitude and phase or real and imaginary part because these are all complex quantities. So, now let us see how we can calculate the frequency response function from the cross spectrum and auto power spectrum. So, f r f can be written as y f by x f this I can write it as this means what I have. So, the frequency response function can be computed as the cross spectrum divided by the auto power spectrum of the input cross spectrum between the output and divide by the auto power spectrum of the input. Now, there is another quantity which you have how are x and y related like in statistics you must have studied about coefficient of co relation if I plot x and y if they are very close by I will say they are nicely correlated in the time domain. Here also in frequency domain we can find out a term known as coherence gamma square f given by s x y f square divided by s x x f s y y f and the maximum value of this could be 1. If I plot the coherence as a function of frequency this will may be if it is like this I can say that at some frequencies the output is not because of the input. So, this has a very very important application in machinery diagnostics and we will see that in the subsequent classes as to how the estimation of coherence frequency response function and cross spectrum can be used to understand whether the output y has been caused by x whether a defect which is notice in y is because of x this can be found out by this coherence. And in machinery condition monitoring when we measure signals from machines we will be trying to find out the coherence between the input and the output between two transducer locations whether one is causing the other and this is a very powerful way of diagnosing or finding the source of a fault. We will be seeing the applications of FFT in the subsequent classes and this was just the basics about the FFT and how we can avoid errors in FFT particularly the frequency resolution and the effects of windowing and then what are the post processing features of the FFT which will be useful for machinery condition monitoring. And then another aspect of FFT is you know I want to still with the available resources I want to see much finer details. So, that can be always increased either you decrease the sampling resolution or increase the time record. So, sometimes decreasing sampling frequency may not be a possible then we have to increase the time record. Thank you.