1
00:00:00,008 --> 00:00:04,480
In module 2.2 we're going to
study the complex exponential.

2
00:00:04,480 --> 00:00:08,760
We had announced this sequence as being
a fundamental character in our play.

3
00:00:08,760 --> 00:00:11,730
And it is time to meet it more in detail.

4
00:00:11,730 --> 00:00:13,790
It is not a completely simple object, but

5
00:00:13,790 --> 00:00:17,560
it has many features that will be
useful later on in this class.

6
00:00:17,560 --> 00:00:22,410
In particular, there are periodic complex
sequence that we are going to see, but

7
00:00:22,410 --> 00:00:25,940
there is also a notion of frequency
which is a discrete time frequency

8
00:00:25,940 --> 00:00:27,480
that is quite subtle.

9
00:00:27,480 --> 00:00:29,730
In continuous time,
frequency is very natural.

10
00:00:29,730 --> 00:00:33,870
Think of frequency for example in music,
in musical instruments, and so on.

11
00:00:33,870 --> 00:00:37,440
In discrete time, the notion is
more subtle, because there is

12
00:00:37,440 --> 00:00:42,330
an increasing frequency that after a while
looks actually like a smaller frequency.

13
00:00:42,330 --> 00:00:45,940
And this phenomenon, which is well known
if you watch old movies when you have

14
00:00:45,940 --> 00:00:47,720
wagon wheels that turn backwards,

15
00:00:47,720 --> 00:00:51,060
even though the wagon is
actually moving forward.

16
00:00:51,060 --> 00:00:53,761
Is an effect called aliasing
that we need to understand,

17
00:00:53,761 --> 00:00:57,042
because it's very particular to
discrete time signal processing.

18
00:00:57,042 --> 00:01:00,500
Then we will finish the module
2.2 by seeing the relationship

19
00:01:00,500 --> 00:01:02,890
between a discrete time frequency and

20
00:01:02,890 --> 00:01:07,120
an equivalent continuous time frequency,
which is very important, for example,

21
00:01:07,120 --> 00:01:12,410
if you want to synthesize a sound from
the computer into an acoustic system.

22
00:01:12,410 --> 00:01:17,700
Or of course in the reverse,
when you acquire a real-time signal from

23
00:01:17,700 --> 00:01:25,870
the continuous time domain and
you want create a sequence.

24
00:01:25,870 --> 00:01:27,153
The overview is the following.

25
00:01:27,153 --> 00:01:32,180
We are going to introduce a complex
exponential, see periodicity,

26
00:01:32,180 --> 00:01:36,030
then a special effect which is
called the wagonwheel effect, and

27
00:01:36,030 --> 00:01:40,970
the maximum speed of discrete
complex exponentials.

28
00:01:40,970 --> 00:01:46,414
Then we are also going to contrast
digital and real-world frequency notions.

29
00:01:48,797 --> 00:01:52,598
As we have said in the previous
sub-module, oscillations are everywhere.

30
00:01:52,598 --> 00:01:55,220
The cardiac beat,

31
00:01:55,220 --> 00:01:59,720
the whistle on the train, the waves
on the ocean, the violin strings.

32
00:02:02,350 --> 00:02:05,700
The oscillation needs
the following ingredients.

33
00:02:05,700 --> 00:02:07,710
First, we need a frequency.

34
00:02:07,710 --> 00:02:09,940
The unit will be radians.

35
00:02:09,940 --> 00:02:15,710
So, we will always look at the unit circle
and the full circle is in radians 2 pi.

36
00:02:15,710 --> 00:02:19,500
There will be an initial phase, phi.

37
00:02:19,500 --> 00:02:22,850
In the same unit of course, radians.

38
00:02:22,850 --> 00:02:25,150
There'll be an amplitude,

39
00:02:25,150 --> 00:02:28,510
this amplitude will depend how we
measure the physical phenomenon.

40
00:02:30,040 --> 00:02:35,520
And we therefore get the trigonometric
function which is the sequence,

41
00:02:35,520 --> 00:02:40,505
for example, x[n],
which is given by A, the amplitude,

42
00:02:40,505 --> 00:02:45,070
times cos(omega n + phi).

43
00:02:45,070 --> 00:02:52,030
So the phase term phi, the frequency
omega, the time index n, okay?

44
00:02:53,280 --> 00:02:58,210
So this is the basic
ingredient of a trigonometric

45
00:02:58,210 --> 00:03:02,650
sequence here is that thiis going to
be periodic and has initial phase phi.

46
00:03:05,750 --> 00:03:08,660
Now, we always use complex exponentials.

47
00:03:08,660 --> 00:03:13,100
Now, some of you might not like
complex numbers, but complex numbers

48
00:03:13,100 --> 00:03:18,560
are our friends here because they
make trigonometry much simpler.

49
00:03:18,560 --> 00:03:25,340
So a trigonometric function that is
expressed as a complex exponential

50
00:03:25,340 --> 00:03:31,000
of course can be reduced to sines and
cosines using Euler's formulas.

51
00:03:31,000 --> 00:03:34,580
Okay, so we have a sequence x[n],
just like previously.

52
00:03:34,580 --> 00:03:41,670
We have let's say A is the amplitude,
e to the j(omega n + phi).

53
00:03:41,670 --> 00:03:46,517
And by Euler's formulas,
this is the amplitude cos(omega n + phi),

54
00:03:46,517 --> 00:03:48,470
that's the real part.

55
00:03:48,470 --> 00:03:52,100
j times sin (omega n+ phi),

56
00:03:52,100 --> 00:03:55,980
which is the imaginary part, and
together we have a complex exponential.

57
00:03:58,900 --> 00:04:04,400
So, we see that sines and
cosines always come together.

58
00:04:04,400 --> 00:04:07,630
The reason why we prefer
exponentials to sines and

59
00:04:07,630 --> 00:04:10,860
cosines is that
the mathematics are simpler.

60
00:04:10,860 --> 00:04:13,870
Instead of doing trigonometry,
we do algebra.

61
00:04:15,280 --> 00:04:17,550
And, last but not least,

62
00:04:17,550 --> 00:04:21,380
we actually have complex numbers in
all digital systems that we use.

63
00:04:21,380 --> 00:04:24,352
So on your computer,
you have real numbers, but

64
00:04:24,352 --> 00:04:28,495
you have also complex numbers, and
you can do complex arithmetic.

65
00:04:30,839 --> 00:04:36,260
Okay, so let's look at an example of the
advantages of using complex exponentials.

66
00:04:36,260 --> 00:04:39,440
So you want to do the change
of phase of a pure cosine.

67
00:04:39,440 --> 00:04:44,440
So you start with the cos(omega n + phi).

68
00:04:44,440 --> 00:04:50,011
This will be written as
a cos(omega n) + b sin(omega n),

69
00:04:50,011 --> 00:04:52,810
where a and b are given here.

70
00:04:52,810 --> 00:04:57,220
So if you know your trigonometry by heart,
you know this is a very natural thing.

71
00:04:58,591 --> 00:05:02,519
But if you don't remember all
the trigonometric formulas,

72
00:05:02,519 --> 00:05:05,870
you can always look them up on Wikipedia.

73
00:05:05,870 --> 00:05:09,950
But it is a little
a cumbersome way to actually

74
00:05:09,950 --> 00:05:13,104
deal with such simple operations, okay?

75
00:05:13,104 --> 00:05:19,880
So instead, what we do is we look
at the change of phase of a pure

76
00:05:19,880 --> 00:05:26,000
cosine by stating that the cosine is
the real part of a complex exponential,

77
00:05:26,000 --> 00:05:30,030
the change of phase up here is
an addition in the exponent.

78
00:05:30,030 --> 00:05:34,190
And the result is that we simply
have a multiplication here

79
00:05:34,190 --> 00:05:36,050
in the complex exponential.

80
00:05:36,050 --> 00:05:40,408
So the phase that was up there,
of course by the fact that

81
00:05:40,408 --> 00:05:44,910
it's in the exponent it will end up just
being a multiplication here by the phase.

82
00:05:44,910 --> 00:05:49,950
So the phase change is extremely simple
in the complex exponential domain.

83
00:05:49,950 --> 00:05:53,270
At the end, we simply take the real part,
we get the cosine, and

84
00:05:53,270 --> 00:05:54,980
we're all done, okay?

85
00:05:56,570 --> 00:06:00,350
Notation is simpler,
phase shift is a simple multiplication.

86
00:06:00,350 --> 00:06:06,080
So, these two effects are why
we prefer complex exponentials.

87
00:06:08,300 --> 00:06:10,680
Okay, so what is a complex exponential?

88
00:06:10,680 --> 00:06:15,270
It is Euler's formula again,
e to the j alpha

89
00:06:15,270 --> 00:06:20,730
is equal to cos alpha + j sin alpha, okay?

90
00:06:20,730 --> 00:06:21,820
I'm repeating myself, but

91
00:06:21,820 --> 00:06:28,320
it's such a beautiful formula that we can
see it a couple of times, it won't hurt.

92
00:06:28,320 --> 00:06:33,290
Okay, so
let's plot this in the complex plane, so

93
00:06:33,290 --> 00:06:38,690
the complex plane has a real axis,
and an imaginary axis.

94
00:06:38,690 --> 00:06:47,730
So e to the j alpha, given by cos alpha +
j sin alpha lives on a unit circle here.

95
00:06:47,730 --> 00:06:50,190
This is nicely the circle here.

96
00:06:50,190 --> 00:06:56,882
And the complex number e to
the j alpha is, well, cos alpha,

97
00:06:56,882 --> 00:07:03,310
which would be here,
+ j sin alpha, which is here.

98
00:07:03,310 --> 00:07:09,390
And it is a vector of length 1
that reaches the unit circle and

99
00:07:09,390 --> 00:07:14,470
has an angle alpha here
with the real axis, okay?

100
00:07:14,470 --> 00:07:19,680
So if you're not very familiar with
this picture, please look at it,

101
00:07:19,680 --> 00:07:23,450
play with it,
play with Euler's formula, go back and

102
00:07:23,450 --> 00:07:28,060
forth between real numbers and
imaginary numbers, and so on.

103
00:07:28,060 --> 00:07:33,340
Because this is the alpha and omega of
what we will be doing here in this class.

104
00:07:36,530 --> 00:07:41,068
Okay, so if we have a point
on the complex plane, z,

105
00:07:41,068 --> 00:07:47,030
In this location, and
we want to rotate it,

106
00:07:47,030 --> 00:07:52,040
then the argument is that we can
simply multiply it by a complex

107
00:07:53,180 --> 00:07:57,660
number here, e to the j alpha,
that's the previous character, and

108
00:07:57,660 --> 00:08:02,830
it will exactly move z by an angle alpha,
okay?

109
00:08:02,830 --> 00:08:07,530
So rotation amounts to
multiplying with the complex

110
00:08:07,530 --> 00:08:12,100
number which is of unit norm.

111
00:08:12,100 --> 00:08:15,200
So, a complex number of
the form e to the j alpha.

112
00:08:16,720 --> 00:08:20,766
So you can see that a relatively
complicated operation on

113
00:08:20,766 --> 00:08:24,560
the complex plane,
which is moving from here to z',

114
00:08:24,560 --> 00:08:30,020
is actually very simple in this
algebra using complex exponentials.

115
00:08:30,020 --> 00:08:34,148
Let's look at what we will call the
complex exponential generating machine.

116
00:08:34,148 --> 00:08:38,255
x[n] = e to the j omega n.

117
00:08:38,255 --> 00:08:44,180
x[n+1] is simply e to the j times x[n].

118
00:08:44,180 --> 00:08:47,800
And so, recursively we're
going to generate successive

119
00:08:47,800 --> 00:08:51,650
samples of this discrete
time complex exponential.

120
00:08:51,650 --> 00:08:56,887
So let's start at x[0],
it's straight on the real line,

121
00:08:56,887 --> 00:09:03,450
as I will move by omega, that gives x[1[,
by 2 omega, is x[2], etc.

122
00:09:03,450 --> 00:09:08,490
It will keep going x[4], 5, 6, 7, and so

123
00:09:08,490 --> 00:09:14,400
on, and in this particular case,
x[12] happens to be back at the origin,

124
00:09:14,400 --> 00:09:20,102
and therefore, it will be a periodic
discrete complex exponential.

125
00:09:20,102 --> 00:09:24,720
Now, if there is an initial phase,
we don't start from the real line, but

126
00:09:24,720 --> 00:09:27,360
we'll start with an angle theta.

127
00:09:27,360 --> 00:09:31,395
But then the same story goes on,
and as we go,

128
00:09:31,395 --> 00:09:35,000
x[6], 7, etc., at x[12],

129
00:09:35,000 --> 00:09:40,340
we will be back at
the same location as x[0].

130
00:09:40,340 --> 00:09:43,160
Now, one has to be careful,

131
00:09:43,160 --> 00:09:48,440
because not every sinusoid is periodic
in discrete time, and we have an example

132
00:09:48,440 --> 00:09:53,339
here where omega is chosen such that
the result will actually not be periodic.

133
00:09:54,450 --> 00:09:58,645
So x[1], move by omega on the unit circle,

134
00:09:58,645 --> 00:10:02,731
x[2], x[3], 4, 5, 6, 7, 8,

135
00:10:02,731 --> 00:10:08,190
is not back to the origin, and
we can keep going like this.

136
00:10:08,190 --> 00:10:11,257
And it's not hard to see that
this will not be periodic.

137
00:10:14,635 --> 00:10:18,830
What does periodicity mean for
a discrete time exponential?

138
00:10:18,830 --> 00:10:22,740
So e to the j omega n is periodic if and

139
00:10:22,740 --> 00:10:28,320
only if omega is equal to
a rational factor of 2 pi.

140
00:10:28,320 --> 00:10:31,939
So, M over N times 2 pi,
where M and N are integers.

141
00:10:33,250 --> 00:10:37,100
And in this case,
we can actually the fact, of course,

142
00:10:37,100 --> 00:10:43,290
that if we add a multiple of 2 pi to
the angle of a complex exponential,

143
00:10:43,290 --> 00:10:45,280
we are back to e to the j omega.

144
00:10:46,660 --> 00:10:51,650
The quiz is about if a single
e to the jn is periodic.

145
00:10:51,650 --> 00:10:56,590
On the complex plane, a single point
can have many different names, and this

146
00:10:57,760 --> 00:11:02,490
uncertainty, in some sense, is one of
the reasons why complex exponentials and

147
00:11:02,490 --> 00:11:09,130
discrete time are interesting but
sometimes difficult objects to deal with.

148
00:11:09,130 --> 00:11:14,390
If I write the red dot here,
e to the j alpha, I could have also

149
00:11:14,390 --> 00:11:19,340
said that it's actually the same,
except that I had gone alpha plus 2 pi.

150
00:11:20,360 --> 00:11:23,020
Or I could have gone alpha plus 6 pi.

151
00:11:23,020 --> 00:11:25,700
Or any multiple of 2 pi.

152
00:11:25,700 --> 00:11:31,030
I could also have said that the angle
was actually a negative angle of alpha

153
00:11:31,030 --> 00:11:36,570
minus 2 pi, and this will give me
the exact same point, e to the j alpha.

154
00:11:36,570 --> 00:11:38,770
So the question is, how fast can we go?

155
00:11:38,770 --> 00:11:42,020
And here we are going to watch a movie,
and

156
00:11:42,020 --> 00:11:46,860
the movie is a depiction of this famous
wagon wheel effect that you probably have

157
00:11:46,860 --> 00:11:52,530
seen, watching western movies,
old western movies on television.

158
00:11:52,530 --> 00:11:54,110
Let us do an experiment.

159
00:11:54,110 --> 00:11:56,410
Here we have the wheel of a bicycle.

160
00:11:56,410 --> 00:12:01,390
It has four spokes, so it has fourfold
symmetry, and between two frames,

161
00:12:01,390 --> 00:12:06,100
we see it advances by the number of
degrees from the upper left corner.

162
00:12:06,100 --> 00:12:09,180
So we see it goes faster and faster.

163
00:12:09,180 --> 00:12:11,930
Now, because of fourfold symmetry,

164
00:12:11,930 --> 00:12:16,610
everything we have seen before as complex
exponentials will be divided by 4.

165
00:12:16,610 --> 00:12:22,560
So when we approach 45 degrees, we start
to have the feeling the wheel goes

166
00:12:23,660 --> 00:12:27,639
backwards, at 45 it has a funny effect,
and it starts to go backwards.

167
00:12:28,700 --> 00:12:30,900
And it will slow down.

168
00:12:32,020 --> 00:12:34,960
Again, the wheel has a fourfold symmetry.

169
00:12:34,960 --> 00:12:39,970
So we are approaching 90
degrees when it will stop.

170
00:12:39,970 --> 00:12:44,220
80, it gets slower and slower.

171
00:12:46,430 --> 00:12:47,270
Even slower.

172
00:12:48,300 --> 00:12:54,290
And at 90, we are soon there,
it will actually stop.

173
00:12:54,290 --> 00:12:56,040
So the wheel is actually turning.

174
00:12:56,040 --> 00:13:00,680
It turns by a quarter of
the circle every frame.

175
00:13:00,680 --> 00:13:04,170
But of course, because of fourfold
symmetry, it actually stops.

176
00:13:05,440 --> 00:13:07,449
Okay, that's an illustration of aliasing.

177
00:13:09,400 --> 00:13:12,880
To understand this,
we are going to look at frequencies and

178
00:13:12,880 --> 00:13:13,940
we increase the frequency.

179
00:13:13,940 --> 00:13:16,820
So the first frequency omega = 2 pi/12.

180
00:13:16,820 --> 00:13:19,620
So it is a very small frequency.

181
00:13:19,620 --> 00:13:24,840
It's one we have seen before, so
x[0], x[1], etc., turns around and

182
00:13:24,840 --> 00:13:29,950
sure enough,
x[12] is back to the real line.

183
00:13:29,950 --> 00:13:34,080
If we take omega is equal to 2 pi/6, so

184
00:13:34,080 --> 00:13:39,580
that's a much larger frequency here,
but it's still a divisor of 2 pi,

185
00:13:39,580 --> 00:13:44,550
and so we have x[1], 2, 3, 4,
5, and x[6] is equal to x[0].

186
00:13:44,550 --> 00:13:47,730
Again, a periodic signal.

187
00:13:47,730 --> 00:13:56,110
If we go up in frequency, omega is now
equal to 2 pi/5, it is a periodic signal,

188
00:13:56,110 --> 00:14:00,270
sure enough, but you can see that
its frequency now is very fast.

189
00:14:01,350 --> 00:14:07,950
2 pi/4, we simply see the four quadrants
here, x[0], x[1], x[2], and x[3].

190
00:14:07,950 --> 00:14:12,910
2 pi/3 divides nicely the unit
circle into three pieces.

191
00:14:12,910 --> 00:14:17,032
2 pi/2 = pi, that's an interesting signal,

192
00:14:17,032 --> 00:14:22,260
because it simply alternates
between +1 and -1.

193
00:14:22,260 --> 00:14:23,720
And it'll alternate like this,

194
00:14:23,720 --> 00:14:28,950
and so this is the maximum frequency
discrete time complex exponential.

195
00:14:28,950 --> 00:14:35,430
Now, if the frequency is between pi and
2 pi, then

196
00:14:35,430 --> 00:14:40,460
there is a solution that we can easily
think of it as a positive frequency,

197
00:14:40,460 --> 00:14:45,750
slightly larger than pi, or a negative
frequency, slightly smaller than pi.

198
00:14:46,760 --> 00:14:52,290
Now, when omega = 2 pi- alpha,
and alpha is small, then of

199
00:14:52,290 --> 00:14:57,190
course we are going to most likely think
that it's actually a negative frequency.

200
00:14:57,190 --> 00:15:03,546
So here we have an example of x[1],
which is 2 pi- alpha away,

201
00:15:03,546 --> 00:15:08,350
but is also minus alpha
from the real line.

202
00:15:08,350 --> 00:15:13,510
And if we do this, we see now that we
have the sense of a negative frequency.

203
00:15:13,510 --> 00:15:18,550
Let's now think about the difference
between digital and physical frequency.

204
00:15:18,550 --> 00:15:23,450
In discrete time, n has no physical
dimensions, it's just a counter.

205
00:15:23,450 --> 00:15:28,590
And periodicity is how many samples
before the pattern repeats.

206
00:15:28,590 --> 00:15:33,840
In the real world, periodicity is how
many seconds before the pattern repeats,

207
00:15:33,840 --> 00:15:38,780
and the frequency is measured in Hz,
or s-1,

208
00:15:38,780 --> 00:15:43,370
which is 1 over the number of
seconds until the pattern repeats.

209
00:15:43,370 --> 00:15:48,980
Now, if you have a PC that plays sound,
you have to map digital frequency or

210
00:15:48,980 --> 00:15:54,180
a discrete time signal x[n] through
a sound card into a loudspeaker.

211
00:15:54,180 --> 00:15:58,220
And so there has to be a relationship
between the clock frequency on your

212
00:15:58,220 --> 00:16:03,530
computer that maps into a physical
frequency out in the real world.

213
00:16:03,530 --> 00:16:05,160
This is given by the system clock.

214
00:16:05,160 --> 00:16:10,300
So, the sound card has a clock Ts and
every Ts second it will

215
00:16:10,300 --> 00:16:14,990
generate a sample that will be
interpolated and fed to the loudspeaker.

216
00:16:14,990 --> 00:16:18,740
We can set the time Ts between samples.

217
00:16:18,740 --> 00:16:25,680
So periodicity of M samples means a
physical periodicity of M times T seconds.

218
00:16:25,680 --> 00:16:33,827
So the real world frequency
is going to be f = 1/MTs.

