In module 2.2 we're going to study the complex exponential. We had announced this sequence as being a fundamental character in our play. And it is time to meet it more in detail. It is not a completely simple object, but it has many features that will be useful later on in this class. In particular, there are periodic complex sequence that we are going to see, but there is also a notion of frequency which is a discrete time frequency that is quite subtle. In continuous time, frequency is very natural. Think of frequency for example in music, in musical instruments, and so on. In discrete time, the notion is more subtle, because there is an increasing frequency that after a while looks actually like a smaller frequency. And this phenomenon, which is well known if you watch old movies when you have wagon wheels that turn backwards, even though the wagon is actually moving forward. Is an effect called aliasing that we need to understand, because it's very particular to discrete time signal processing. Then we will finish the module 2.2 by seeing the relationship between a discrete time frequency and an equivalent continuous time frequency, which is very important, for example, if you want to synthesize a sound from the computer into an acoustic system. Or of course in the reverse, when you acquire a real-time signal from the continuous time domain and you want create a sequence. The overview is the following. We are going to introduce a complex exponential, see periodicity, then a special effect which is called the wagonwheel effect, and the maximum speed of discrete complex exponentials. Then we are also going to contrast digital and real-world frequency notions. As we have said in the previous sub-module, oscillations are everywhere. The cardiac beat, the whistle on the train, the waves on the ocean, the violin strings. The oscillation needs the following ingredients. First, we need a frequency. The unit will be radians. So, we will always look at the unit circle and the full circle is in radians 2 pi. There will be an initial phase, phi. In the same unit of course, radians. There'll be an amplitude, this amplitude will depend how we measure the physical phenomenon. And we therefore get the trigonometric function which is the sequence, for example, x[n], which is given by A, the amplitude, times cos(omega n + phi). So the phase term phi, the frequency omega, the time index n, okay? So this is the basic ingredient of a trigonometric sequence here is that thiis going to be periodic and has initial phase phi. Now, we always use complex exponentials. Now, some of you might not like complex numbers, but complex numbers are our friends here because they make trigonometry much simpler. So a trigonometric function that is expressed as a complex exponential of course can be reduced to sines and cosines using Euler's formulas. Okay, so we have a sequence x[n], just like previously. We have let's say A is the amplitude, e to the j(omega n + phi). And by Euler's formulas, this is the amplitude cos(omega n + phi), that's the real part. j times sin (omega n+ phi), which is the imaginary part, and together we have a complex exponential. So, we see that sines and cosines always come together. The reason why we prefer exponentials to sines and cosines is that the mathematics are simpler. Instead of doing trigonometry, we do algebra. And, last but not least, we actually have complex numbers in all digital systems that we use. So on your computer, you have real numbers, but you have also complex numbers, and you can do complex arithmetic. Okay, so let's look at an example of the advantages of using complex exponentials. So you want to do the change of phase of a pure cosine. So you start with the cos(omega n + phi). This will be written as a cos(omega n) + b sin(omega n), where a and b are given here. So if you know your trigonometry by heart, you know this is a very natural thing. But if you don't remember all the trigonometric formulas, you can always look them up on Wikipedia. But it is a little a cumbersome way to actually deal with such simple operations, okay? So instead, what we do is we look at the change of phase of a pure cosine by stating that the cosine is the real part of a complex exponential, the change of phase up here is an addition in the exponent. And the result is that we simply have a multiplication here in the complex exponential. So the phase that was up there, of course by the fact that it's in the exponent it will end up just being a multiplication here by the phase. So the phase change is extremely simple in the complex exponential domain. At the end, we simply take the real part, we get the cosine, and we're all done, okay? Notation is simpler, phase shift is a simple multiplication. So, these two effects are why we prefer complex exponentials. Okay, so what is a complex exponential? It is Euler's formula again, e to the j alpha is equal to cos alpha + j sin alpha, okay? I'm repeating myself, but it's such a beautiful formula that we can see it a couple of times, it won't hurt. Okay, so let's plot this in the complex plane, so the complex plane has a real axis, and an imaginary axis. So e to the j alpha, given by cos alpha + j sin alpha lives on a unit circle here. This is nicely the circle here. And the complex number e to the j alpha is, well, cos alpha, which would be here, + j sin alpha, which is here. And it is a vector of length 1 that reaches the unit circle and has an angle alpha here with the real axis, okay? So if you're not very familiar with this picture, please look at it, play with it, play with Euler's formula, go back and forth between real numbers and imaginary numbers, and so on. Because this is the alpha and omega of what we will be doing here in this class. Okay, so if we have a point on the complex plane, z, In this location, and we want to rotate it, then the argument is that we can simply multiply it by a complex number here, e to the j alpha, that's the previous character, and it will exactly move z by an angle alpha, okay? So rotation amounts to multiplying with the complex number which is of unit norm. So, a complex number of the form e to the j alpha. So you can see that a relatively complicated operation on the complex plane, which is moving from here to z', is actually very simple in this algebra using complex exponentials. Let's look at what we will call the complex exponential generating machine. x[n] = e to the j omega n. x[n+1] is simply e to the j times x[n]. And so, recursively we're going to generate successive samples of this discrete time complex exponential. So let's start at x[0], it's straight on the real line, as I will move by omega, that gives x[1[, by 2 omega, is x[2], etc. It will keep going x[4], 5, 6, 7, and so on, and in this particular case, x[12] happens to be back at the origin, and therefore, it will be a periodic discrete complex exponential. Now, if there is an initial phase, we don't start from the real line, but we'll start with an angle theta. But then the same story goes on, and as we go, x[6], 7, etc., at x[12], we will be back at the same location as x[0]. Now, one has to be careful, because not every sinusoid is periodic in discrete time, and we have an example here where omega is chosen such that the result will actually not be periodic. So x[1], move by omega on the unit circle, x[2], x[3], 4, 5, 6, 7, 8, is not back to the origin, and we can keep going like this. And it's not hard to see that this will not be periodic. What does periodicity mean for a discrete time exponential? So e to the j omega n is periodic if and only if omega is equal to a rational factor of 2 pi. So, M over N times 2 pi, where M and N are integers. And in this case, we can actually the fact, of course, that if we add a multiple of 2 pi to the angle of a complex exponential, we are back to e to the j omega. The quiz is about if a single e to the jn is periodic. On the complex plane, a single point can have many different names, and this uncertainty, in some sense, is one of the reasons why complex exponentials and discrete time are interesting but sometimes difficult objects to deal with. If I write the red dot here, e to the j alpha, I could have also said that it's actually the same, except that I had gone alpha plus 2 pi. Or I could have gone alpha plus 6 pi. Or any multiple of 2 pi. I could also have said that the angle was actually a negative angle of alpha minus 2 pi, and this will give me the exact same point, e to the j alpha. So the question is, how fast can we go? And here we are going to watch a movie, and the movie is a depiction of this famous wagon wheel effect that you probably have seen, watching western movies, old western movies on television. Let us do an experiment. Here we have the wheel of a bicycle. It has four spokes, so it has fourfold symmetry, and between two frames, we see it advances by the number of degrees from the upper left corner. So we see it goes faster and faster. Now, because of fourfold symmetry, everything we have seen before as complex exponentials will be divided by 4. So when we approach 45 degrees, we start to have the feeling the wheel goes backwards, at 45 it has a funny effect, and it starts to go backwards. And it will slow down. Again, the wheel has a fourfold symmetry. So we are approaching 90 degrees when it will stop. 80, it gets slower and slower. Even slower. And at 90, we are soon there, it will actually stop. So the wheel is actually turning. It turns by a quarter of the circle every frame. But of course, because of fourfold symmetry, it actually stops. Okay, that's an illustration of aliasing. To understand this, we are going to look at frequencies and we increase the frequency. So the first frequency omega = 2 pi/12. So it is a very small frequency. It's one we have seen before, so x[0], x[1], etc., turns around and sure enough, x[12] is back to the real line. If we take omega is equal to 2 pi/6, so that's a much larger frequency here, but it's still a divisor of 2 pi, and so we have x[1], 2, 3, 4, 5, and x[6] is equal to x[0]. Again, a periodic signal. If we go up in frequency, omega is now equal to 2 pi/5, it is a periodic signal, sure enough, but you can see that its frequency now is very fast. 2 pi/4, we simply see the four quadrants here, x[0], x[1], x[2], and x[3]. 2 pi/3 divides nicely the unit circle into three pieces. 2 pi/2 = pi, that's an interesting signal, because it simply alternates between +1 and -1. And it'll alternate like this, and so this is the maximum frequency discrete time complex exponential. Now, if the frequency is between pi and 2 pi, then there is a solution that we can easily think of it as a positive frequency, slightly larger than pi, or a negative frequency, slightly smaller than pi. Now, when omega = 2 pi- alpha, and alpha is small, then of course we are going to most likely think that it's actually a negative frequency. So here we have an example of x[1], which is 2 pi- alpha away, but is also minus alpha from the real line. And if we do this, we see now that we have the sense of a negative frequency. Let's now think about the difference between digital and physical frequency. In discrete time, n has no physical dimensions, it's just a counter. And periodicity is how many samples before the pattern repeats. In the real world, periodicity is how many seconds before the pattern repeats, and the frequency is measured in Hz, or s-1, which is 1 over the number of seconds until the pattern repeats. Now, if you have a PC that plays sound, you have to map digital frequency or a discrete time signal x[n] through a sound card into a loudspeaker. And so there has to be a relationship between the clock frequency on your computer that maps into a physical frequency out in the real world. This is given by the system clock. So, the sound card has a clock Ts and every Ts second it will generate a sample that will be interpolated and fed to the loudspeaker. We can set the time Ts between samples. So periodicity of M samples means a physical periodicity of M times T seconds. So the real world frequency is going to be f = 1/MTs.