Now let's put these ideas together and sum this up by talking about spectral analysis. So we want to analyze a signal, just an arbitrary signal in time, and so here's amplitude verses time of the signal that we're going to analyze, and that signal has a finite duration in time capital T. Now we could always make the signal satisfy the periodic condition for a Fourier series by just repeating the signal. Again, after time T and so we could make this periodic. But we only have to worry about this one cycle of the signal. And so what we're going to do then is construct a series of signs starting with the lowest frequency sign having a frequency of 1 over the duration of the signal. So let's say that this signal had a time duration of one second, then the frequency of the lowest frequency basis function, the lowest sine wave, would be one over one second, or one hertz. So, what we do then is we compute, we multiply the basis function, the one hertz sine basis function times the signal and then sum up the area of their product in that Fourier integral. And this, this then gives us the lowest frequency in the spectrum. So if I had a recording of sound of one second long. And I wanted to do a Fourier analysis of that, piece of, of recording. The lowest frequency I can infer in the recipe for that is at one hertz. One over this time. If I had ten seconds of of recording, then the lowest frequency be, would be one tenth of a hertz. If this time were, say, one tenth of a second, then the slowest frequency would correspond to ten hertz. And so when we compute that Fourier integral, then we get the b1 coefficient for the Fourier series. Then we go on and we look at the second harmonic of this fundamental. So now we have two complete wave forms in this time interval, and this is a frequency of 2 times f0. And when I compute the Fourier series with that which is just nothing more to remind you, it's nothing more than just multiplying this curve times the original curve. And then summing up the area of the resulting product curve, counting, area above the axis as positive and below the axis as negative. And so if we, we do that, [LAUGH] then we get b2. That's a measure of the similarity of the 2f0 sine wave to our original signal, and then we do the same thing with 3f0 to get b3, 4f0 to get b4, and so on. Now that takes care of the beats, this is the sines terms in the Fourier series. Now we also need to measure this similarity, oh, and I should just add that this goes onto infinite frequency, theoretically. But in practice, any kind of audio signal that we're going to encounter is usually at 20 kilohertz or less. And so, so you only need to go out to, say, 20 kilohertz at most in this kind of spectral analysis. Now, this takes care of the signs, but we also have to worry about the cosines and so here's the same signal of duration T. And we have to look at the similarity of that signal to the lowest frequency cosine wave and so this cosine has a frequency that's one over T. And that will correspond then to the lowest frequency in the spectrum, and that will be the a1 coefficient, and then we go on and look at 2f0, and that gives us a2, and then 3f0 and that gives us a3. And you can keep going just like you did for the sines. And so, once we've measured the similarity of our original signal to all of the cosine basis functions and all of the sine basis functions, we have a complete set of As for the cosines and the Bs for the sines. And now if we want to ask, what is the spectral, component at a certain frequency. We almost always discompute the magnititude of that. Now it turns out the, and we're not going to, dwell on this, but, the sine part, just like when we were talking about complex exponentials. The sine function is like the imaginary part of that. The cosine is the real park. And what we are doing here is we are computing the magnitude of the imaginary and real parts. And so the magnitude of this complex number is just the a squared plus b squared. And so you have a magnitude at each frequency and what is normally plotted in a, a spectrum of a signal is its magnitude. Sometimes the phases is important, for some applications, but for giving an idea of what the frequency content of a signal is normally we don't care about the phase if at a particular frequency it's like the sin wave or the cosine wave. It really doesn't matter, but, so in that case we just compute the magnitude. Now I want to wrap up this section by giving two spectral analysis examples. Now again we wrote a MATLAB program that takes a short recording of first an electric guitar and then second, an instrument that probably most of you have never seen, a contrabass saxophone. And then it computes the spectrum of that signal, in little time intervals and then displays that as a function of time. So take a look at these two MATLAB computations.