WEBVTT
00:00:13.530 --> 00:00:16.290
MICHALE FEE: So who
remembers what that's called?
00:00:16.290 --> 00:00:17.950
A spectrograph.
00:00:17.950 --> 00:00:19.600
Good.
00:00:19.600 --> 00:00:22.525
And it's a spectrogram of me.
00:00:26.470 --> 00:00:28.050
Good morning, class.
00:00:28.050 --> 00:00:28.660
OK.
00:00:28.660 --> 00:00:31.780
So it's a spectrogram of speech.
00:00:31.780 --> 00:00:36.700
And so we are going
to continue today
00:00:36.700 --> 00:00:39.590
on the topic of understanding--
00:00:39.590 --> 00:00:41.590
developing methods
for understanding
00:00:41.590 --> 00:00:46.030
how to characterize
and understand
00:00:46.030 --> 00:00:47.460
temporally structured signals.
00:00:47.460 --> 00:00:49.540
So that is the
microphone recording
00:00:49.540 --> 00:00:52.810
of my voice saying
"good morning, class."
00:00:52.810 --> 00:00:56.020
And then this is a spectrogram
of that signal where
00:00:56.020 --> 00:00:58.120
at each moment in
time, you can actually
00:00:58.120 --> 00:01:01.220
extract the spectral
structure of that signal.
00:01:01.220 --> 00:01:04.989
And you can see that the
information in speech signals
00:01:04.989 --> 00:01:12.970
is actually carried in parts of
the signal in the way the power
00:01:12.970 --> 00:01:16.850
in the signal at different
frequencies changes over time.
00:01:16.850 --> 00:01:20.410
And your ears detect
these changes in frequency
00:01:20.410 --> 00:01:22.480
and translate that
into information
00:01:22.480 --> 00:01:25.030
about what I'm saying.
00:01:25.030 --> 00:01:31.420
And so we're going to
today start on a-- well,
00:01:31.420 --> 00:01:33.550
we sort of started last
time, but we're really
00:01:33.550 --> 00:01:37.870
going to get going on this
in the next three lectures.
00:01:37.870 --> 00:01:41.530
We're going to develop
a powerful set of tools
00:01:41.530 --> 00:01:44.230
for characterizing
and understanding
00:01:44.230 --> 00:01:46.780
the temporal
structure of signals.
00:01:46.780 --> 00:01:52.390
So this is the game plan
for the next three lectures.
00:01:52.390 --> 00:01:55.420
Today we're going to
cover Fourier series--
00:01:55.420 --> 00:01:56.710
complex Fourier series.
00:01:56.710 --> 00:01:59.620
We're going to extend that
to the idea of the Fourier
00:01:59.620 --> 00:02:00.760
transform.
00:02:00.760 --> 00:02:02.460
And then so the
Fourier transform
00:02:02.460 --> 00:02:06.940
is sort of a very general
mathematical approach
00:02:06.940 --> 00:02:10.150
to understanding the temporal
structure of signals.
00:02:10.150 --> 00:02:12.340
That's more of a--
00:02:12.340 --> 00:02:15.820
you think of that
more in terms of doing
00:02:15.820 --> 00:02:22.360
analytical calculations or sort
of conceptual understanding
00:02:22.360 --> 00:02:27.380
of what Fourier
decomposition is.
00:02:27.380 --> 00:02:33.160
But then there's a
very concrete algorithm
00:02:33.160 --> 00:02:37.020
for characterizing spectral
structure of signals called
00:02:37.020 --> 00:02:38.290
the fast Fourier transform.
00:02:38.290 --> 00:02:43.480
And that's one class of methods
where you sample signals
00:02:43.480 --> 00:02:47.710
discretely in time and
get back discrete power
00:02:47.710 --> 00:02:49.120
at discrete frequencies.
00:02:49.120 --> 00:02:51.580
So that's called a
discrete Fourier transform.
00:02:51.580 --> 00:02:53.770
And most often that's
used to compute
00:02:53.770 --> 00:02:56.170
the power spectrum of signals.
00:02:56.170 --> 00:02:59.570
And so that's what we're
going to cover today.
00:02:59.570 --> 00:03:02.400
And then in the
next lecture, we're
00:03:02.400 --> 00:03:04.990
going to cover a number
of topics leading up
00:03:04.990 --> 00:03:06.257
to spectral estimation.
00:03:06.257 --> 00:03:08.590
We're going to start with the
convolution theorem, which
00:03:08.590 --> 00:03:11.650
is a really powerful
way of understanding
00:03:11.650 --> 00:03:15.550
the relationship
between convolution
00:03:15.550 --> 00:03:18.160
in the time domain and
multiplication of things
00:03:18.160 --> 00:03:19.690
in the frequency domain.
00:03:19.690 --> 00:03:22.450
And the convolution
theorem is really powerful,
00:03:22.450 --> 00:03:25.000
allowing you to kind of
think about, intuitively
00:03:25.000 --> 00:03:27.550
understand the spectral
structure of different kinds
00:03:27.550 --> 00:03:31.682
of signals that you can build
by convolving different sort
00:03:31.682 --> 00:03:33.800
of basic elements.
00:03:33.800 --> 00:03:39.010
So if you understand the Fourier
decomposition of a square pulse
00:03:39.010 --> 00:03:43.790
and a train of
pulses or a Gaussian,
00:03:43.790 --> 00:03:47.920
you can basically just by
kind of thinking about it
00:03:47.920 --> 00:03:49.330
figure out the
spectral structure
00:03:49.330 --> 00:03:52.600
of a lot of different signals
by just combining those things
00:03:52.600 --> 00:03:53.710
sort of like LEGO blocks.
00:03:53.710 --> 00:03:55.060
It's super cool.
00:03:55.060 --> 00:03:58.120
We're going to talk about
noise and filtering.
00:03:58.120 --> 00:04:00.850
We're going to talk about
the Shannon-Nyquist sampling
00:04:00.850 --> 00:04:03.040
theorem, which tells
you how fast you
00:04:03.040 --> 00:04:06.400
have to sample a signal in order
to perfectly reconstruct it.
00:04:06.400 --> 00:04:08.100
It turns out it's
really amazing.
00:04:08.100 --> 00:04:10.180
If you have a
signal in time, you
00:04:10.180 --> 00:04:12.910
can sample that signal
at regular intervals
00:04:12.910 --> 00:04:15.910
and perfectly
reconstruct the signal
00:04:15.910 --> 00:04:20.230
if that signal doesn't have
frequency components that
00:04:20.230 --> 00:04:21.130
are too high.
00:04:21.130 --> 00:04:23.650
And so that's captured in
this Shannon-Nyquist sampling
00:04:23.650 --> 00:04:24.190
theorem.
00:04:24.190 --> 00:04:28.220
That turns out to actually
be a topic of current debate.
00:04:28.220 --> 00:04:31.150
There was a paper
published recently
00:04:31.150 --> 00:04:34.930
by somebody claiming to be
able to get around the sampling
00:04:34.930 --> 00:04:38.800
theorem and record neural
signals without having
00:04:38.800 --> 00:04:41.830
to guarantee the
conditions under which
00:04:41.830 --> 00:04:45.820
the Shannon-Nyquist
sampling theorem claims.
00:04:45.820 --> 00:04:50.350
And Markus Meister wrote
a scathing rebuttal
00:04:50.350 --> 00:04:53.650
to that basically claiming
that they're full of baloney.
00:04:53.650 --> 00:04:58.360
And so those folks who
wrote that paper maybe
00:04:58.360 --> 00:05:00.700
should have taken this class.
00:05:00.700 --> 00:05:02.910
So anyway, you don't want
to be on the wrong end
00:05:02.910 --> 00:05:06.520
of Markus Meister's blog post.
00:05:06.520 --> 00:05:09.330
So pay attention.
00:05:09.330 --> 00:05:11.748
So then we're going to get
into spectral estimation.
00:05:11.748 --> 00:05:13.290
Then in the last
lecture, we're going
00:05:13.290 --> 00:05:14.940
to talk about spectrograms.
00:05:14.940 --> 00:05:17.340
We're going to talk about
how to compute spectrograms
00:05:17.340 --> 00:05:20.280
and understand really
how to take the data
00:05:20.280 --> 00:05:22.830
and break it into
samples called windowing,
00:05:22.830 --> 00:05:26.280
how to multiply those samples
by what's called a taper
00:05:26.280 --> 00:05:29.100
to avoid contaminating
the signal with lots
00:05:29.100 --> 00:05:30.918
of noise that's unnecessary.
00:05:30.918 --> 00:05:33.460
We're going to understand the
idea of time bandwidth product.
00:05:33.460 --> 00:05:35.220
How do you choose the
width of that window
00:05:35.220 --> 00:05:37.470
to emphasize different
parts of the data?
00:05:37.470 --> 00:05:41.460
And then we're going to end
with some advanced filtering
00:05:41.460 --> 00:05:48.690
methods that are commonly used
to control different frequency
00:05:48.690 --> 00:05:51.390
components of
signals in your data.
00:05:51.390 --> 00:05:53.830
So a bunch of really
powerful things.
00:05:53.830 --> 00:05:57.000
Here's what we're going
to talk about today.
00:05:57.000 --> 00:05:59.250
We're going to continue
with this Fourier series.
00:05:59.250 --> 00:06:01.693
We started with symmetric
functions last time.
00:06:01.693 --> 00:06:03.360
We're going to finish
that and then talk
00:06:03.360 --> 00:06:05.100
about asymmetric functions.
00:06:05.100 --> 00:06:08.610
We're going to extend that
to complex Fourier series,
00:06:08.610 --> 00:06:10.950
introduce the Fourier transform
and the discrete Fourier
00:06:10.950 --> 00:06:13.980
transform and this algorithm
and the fast Fourier transform,
00:06:13.980 --> 00:06:17.940
and then I'm going to show you
how to compute power spectrum.
00:06:17.940 --> 00:06:22.770
So just to make it
clear, all of this stuff
00:06:22.770 --> 00:06:25.110
is basically going
to be to teach you
00:06:25.110 --> 00:06:27.990
how to use one line of MATLAB.
00:06:27.990 --> 00:06:30.720
One function, FFT.
00:06:30.720 --> 00:06:37.170
Now, the problem is it's
really easy to do this wrong.
00:06:37.170 --> 00:06:39.780
It's really easy
to use this but not
00:06:39.780 --> 00:06:44.340
understand what you're doing and
come up with the wrong answer.
00:06:44.340 --> 00:06:47.580
So all of these things that
we're going to talk about today
00:06:47.580 --> 00:06:49.920
are just the kind
of basics that you
00:06:49.920 --> 00:06:53.680
need to understand in order to
use this very powerful function
00:06:53.680 --> 00:06:54.180
in MATLAB.
00:06:56.760 --> 00:06:58.830
All right.
00:06:58.830 --> 00:06:59.890
So let's get started.
00:06:59.890 --> 00:07:03.665
So last time, we introduced
the idea of a Fourier series.
00:07:03.665 --> 00:07:05.040
We talked about
the idea that you
00:07:05.040 --> 00:07:07.330
can approximate any
periodic function.
00:07:07.330 --> 00:07:10.680
So here I'm just taking a
square wave that alternates
00:07:10.680 --> 00:07:12.990
between positive and negative.
00:07:12.990 --> 00:07:15.300
It's periodic with
a period capital T.
00:07:15.300 --> 00:07:16.870
So it's a function of time.
00:07:16.870 --> 00:07:21.150
It's a even function or
a symmetric function,
00:07:21.150 --> 00:07:23.970
because you can see that
it's basically mirror
00:07:23.970 --> 00:07:27.040
symmetry around the y-axis.
00:07:27.040 --> 00:07:29.970
It's even because
even polynomials also
00:07:29.970 --> 00:07:33.060
have that property
of being symmetric.
00:07:33.060 --> 00:07:36.690
We can approximate
this periodic function
00:07:36.690 --> 00:07:41.490
T as a sum of sine waves or
cosine waves, in this case.
00:07:41.490 --> 00:07:47.310
We can approximate that as a
cosine wave of the same period
00:07:47.310 --> 00:07:49.120
and the same amplitude.
00:07:49.120 --> 00:07:53.760
So we can approximate as a
coefficient times cosine 2 pi
00:07:53.760 --> 00:07:58.210
f0 t where f0 is just
1 over the period.
00:07:58.210 --> 00:08:00.940
So if the period is one
second, then the frequency
00:08:00.940 --> 00:08:03.610
is 1 hertz, 1 over 1 second.
00:08:03.610 --> 00:08:08.740
We often use this
different representation
00:08:08.740 --> 00:08:12.170
of frequency, which is
usually called omega,
00:08:12.170 --> 00:08:15.400
which is angular frequency.
00:08:15.400 --> 00:08:19.920
And it's just 2 pi times
this oscillation frequency.
00:08:19.920 --> 00:08:23.620
And it has units of
radians per second.
00:08:23.620 --> 00:08:26.470
So we talked about
the fact that you
00:08:26.470 --> 00:08:31.480
can approximate this periodic
function as a sum of cosines.
00:08:31.480 --> 00:08:33.520
We talked about the
idea that you only
00:08:33.520 --> 00:08:36.610
need to consider cosines that
are integer multiples of omega
00:08:36.610 --> 00:08:40.600
0, because those are the
only cosine functions,
00:08:40.600 --> 00:08:43.780
those are the only
functions, that also are
00:08:43.780 --> 00:08:47.200
periodic at frequency omega 0.
00:08:47.200 --> 00:08:51.370
So a function cosine
3 omega 0 t is also
00:08:51.370 --> 00:08:54.390
periodic at frequency omega 0.
00:08:54.390 --> 00:08:56.740
Does that make sense?
00:08:56.740 --> 00:09:01.510
So now we can approximate
any periodic function.
00:09:01.510 --> 00:09:04.720
In this case, any even
or symmetric periodic
00:09:04.720 --> 00:09:12.340
function as a sum of cosines
of frequencies that are
00:09:12.340 --> 00:09:14.133
integer multiples of omega 0.
00:09:14.133 --> 00:09:15.550
And each one of
those cosines will
00:09:15.550 --> 00:09:17.320
have a different coefficient.
00:09:17.320 --> 00:09:23.050
So here's an example where I'm
approximating this square wave
00:09:23.050 --> 00:09:27.232
here as a sum of cosines of
these different frequencies.
00:09:27.232 --> 00:09:28.690
And it turns out
for a square wave,
00:09:28.690 --> 00:09:33.460
you only need the odd
multiples of omega 0.
00:09:33.460 --> 00:09:35.920
So here's what
this approximation
00:09:35.920 --> 00:09:38.800
looks like for the case where
you only have a single cosine
00:09:38.800 --> 00:09:39.730
function.
00:09:39.730 --> 00:09:43.088
You can add another
cosine of 3 omega 0 t
00:09:43.088 --> 00:09:45.130
and you can see that that
function starts getting
00:09:45.130 --> 00:09:46.960
a little bit more square.
00:09:46.960 --> 00:09:49.720
You can add a
cosine 5 omega 0 t.
00:09:49.720 --> 00:09:51.310
And as you keep
adding those things,
00:09:51.310 --> 00:09:54.470
again, with the correct
coefficients in front of these,
00:09:54.470 --> 00:09:56.650
you can see that the
function more and more
00:09:56.650 --> 00:10:00.950
closely approximates the square
wave that we're trying to--
00:10:00.950 --> 00:10:01.590
yes, Habiba
00:10:01.590 --> 00:10:04.320
AUDIENCE: Why do we only
need the odd multiples?
00:10:04.320 --> 00:10:06.310
MICHALE FEE: It
just, in general, you
00:10:06.310 --> 00:10:08.050
need all the multiples.
00:10:08.050 --> 00:10:09.685
But for this
particular function,
00:10:09.685 --> 00:10:10.810
you only need the odd ones.
00:10:22.210 --> 00:10:23.230
Here's another example.
00:10:23.230 --> 00:10:28.770
So in this case, we are summing
together cosine functions
00:10:28.770 --> 00:10:33.870
to approximate a
train of pulses.
00:10:33.870 --> 00:10:36.330
So the signal we're
trying to approximate here
00:10:36.330 --> 00:10:42.130
just has a pulse every one
unit of time, one period.
00:10:42.130 --> 00:10:44.100
And you can see that
to approximate this,
00:10:44.100 --> 00:10:47.370
we can basically just
sum up all the cosines
00:10:47.370 --> 00:10:50.370
of all frequencies n omega 0.
00:10:50.370 --> 00:10:55.350
And you can see that at time
0, all of those functions
00:10:55.350 --> 00:10:56.820
are positive.
00:10:56.820 --> 00:11:02.400
And so all of those positive
contributions to that sum
00:11:02.400 --> 00:11:03.620
all add up.
00:11:03.620 --> 00:11:06.030
And as you add them
up, you get a big peak.
00:11:06.030 --> 00:11:08.190
That's called
constructive interference.
00:11:08.190 --> 00:11:11.700
So all those peaks add up.
00:11:11.700 --> 00:11:16.650
And you also get those peaks
all adding up one period away.
00:11:16.650 --> 00:11:20.910
One period of cosine omega 0.
00:11:20.910 --> 00:11:22.380
You can see they add up again.
00:11:22.380 --> 00:11:24.300
So you can see this is
a periodic function.
00:11:24.300 --> 00:11:27.540
In this time window
between those peaks,
00:11:27.540 --> 00:11:29.910
you can see that you have
positive peaks of some
00:11:29.910 --> 00:11:33.360
of those cosines, negative
peaks, positive, negative.
00:11:33.360 --> 00:11:35.220
They just sort of all add up.
00:11:35.220 --> 00:11:38.430
They interfere with
each other destructively
00:11:38.430 --> 00:11:41.850
to give you a 0 in the
intervals between the peaks.
00:11:41.850 --> 00:11:43.090
Does that make sense?
00:11:43.090 --> 00:11:46.260
And so basically, by
choosing the amplitude
00:11:46.260 --> 00:11:47.790
of these different
cosine functions,
00:11:47.790 --> 00:11:52.140
you can basically build any
arbitrary periodic function
00:11:52.140 --> 00:11:52.980
down here.
00:11:52.980 --> 00:11:56.460
Does that makes sense?
00:11:56.460 --> 00:11:57.030
All right.
00:11:57.030 --> 00:11:59.250
There's one more
element that we need
00:11:59.250 --> 00:12:03.270
to add here for our Fourier
series for even functions.
00:12:03.270 --> 00:12:05.730
Anybody have any
idea what that is?
00:12:05.730 --> 00:12:10.020
Notice here I've shifted this
function up a little bit.
00:12:10.020 --> 00:12:12.630
So it's not centered at 0.
00:12:12.630 --> 00:12:13.730
A constant term.
00:12:13.730 --> 00:12:15.900
What's called a DC term.
00:12:15.900 --> 00:12:18.780
We basically take the
average of that function.
00:12:18.780 --> 00:12:19.830
We add it here.
00:12:19.830 --> 00:12:22.760
That's called a DC term.
00:12:22.760 --> 00:12:25.380
a 0 over 2 is
essentially the average
00:12:25.380 --> 00:12:28.330
of the function we're
trying to approximate.
00:12:28.330 --> 00:12:28.830
All right.
00:12:28.830 --> 00:12:30.060
Good.
00:12:30.060 --> 00:12:32.250
We can now write that as a sum.
00:12:32.250 --> 00:12:36.810
y even of t equals
a0 over 2 plus a sum
00:12:36.810 --> 00:12:41.090
over all these different
n's of a sub n,
00:12:41.090 --> 00:12:45.010
which is a coefficient,
times cosine n omega 0 t.
00:12:45.010 --> 00:12:47.460
Omega 0 is 1 over--
00:12:47.460 --> 00:12:52.570
is 2 pi over this time
interval here, the periodicity.
00:12:55.160 --> 00:12:55.660
All right.
00:12:55.660 --> 00:12:56.630
Good.
00:12:56.630 --> 00:12:59.670
How do we find
those coefficients?
00:12:59.670 --> 00:13:02.690
So I just told you that the
first coefficient, the a 0
00:13:02.690 --> 00:13:05.540
over 2, is just the
average of our function t
00:13:05.540 --> 00:13:10.240
over one time window from minus
t over 2 to plus t over 2.
00:13:10.240 --> 00:13:12.440
It's just the integral
of that function
00:13:12.440 --> 00:13:13.970
over one period divided by t.
00:13:13.970 --> 00:13:16.340
And that gives you the
average, which is a 0 over 2.
00:13:19.350 --> 00:13:20.850
All right, any
questions about that?
00:13:20.850 --> 00:13:22.150
It's pretty straightforward.
00:13:22.150 --> 00:13:24.930
What about this next
coefficient, a1?
00:13:24.930 --> 00:13:28.470
So the a1 coefficient is just
the overlap of our function
00:13:28.470 --> 00:13:30.810
y of t with this cosine.
00:13:35.830 --> 00:13:41.280
We're just multiplying y0
times cosine of omega 0 t
00:13:41.280 --> 00:13:49.680
integrating over time and
then multiplying by 2 over t.
00:13:49.680 --> 00:13:51.780
So that's the answer.
00:13:51.780 --> 00:13:54.520
And I'm going to
explain why that is.
00:13:58.520 --> 00:14:01.550
That is just a correlation.
00:14:01.550 --> 00:14:05.140
It's just like asking how much--
00:14:05.140 --> 00:14:10.720
let's say we had a neuron with a
receptive field of cosine omega
00:14:10.720 --> 00:14:11.650
0 t.
00:14:11.650 --> 00:14:15.310
We're asking how well
does our signal overlap
00:14:15.310 --> 00:14:17.165
with that receptive field.
00:14:17.165 --> 00:14:18.040
Does that make sense?
00:14:18.040 --> 00:14:21.660
We're just
correlating our signal
00:14:21.660 --> 00:14:27.060
with some basis function,
with some receptive field.
00:14:27.060 --> 00:14:32.600
And we're asking how
much overlap is there.
00:14:32.600 --> 00:14:35.510
The a2 coefficient is just
the overlap of the function
00:14:35.510 --> 00:14:39.300
y with cosine 2 omega 0 t.
00:14:39.300 --> 00:14:41.520
And the a sub n
coefficient is just
00:14:41.520 --> 00:14:43.900
the overlap with
cosine n omega 0 t.
00:14:46.455 --> 00:14:47.080
Just like that.
00:14:49.740 --> 00:14:53.300
And you can see that this
average that we took up here
00:14:53.300 --> 00:14:55.460
just is the
generalization of this
00:14:55.460 --> 00:15:00.830
to the overlap of our function
to cosine 0 omega 0 t.
00:15:00.830 --> 00:15:04.840
Cosine 0 omega 0 t is just 1.
00:15:04.840 --> 00:15:11.022
And so this coefficient a0
just looks the same as this.
00:15:11.022 --> 00:15:12.730
It's just that in this
case, it turns out
00:15:12.730 --> 00:15:15.770
to be the average
of the function.
00:15:15.770 --> 00:15:19.230
Any questions about that?
00:15:19.230 --> 00:15:23.110
So that is, in general, how you
calculate those coefficients.
00:15:23.110 --> 00:15:25.800
So you would literally
just take your function,
00:15:25.800 --> 00:15:30.703
multiply it by a cosine of
some frequency, integrate it,
00:15:30.703 --> 00:15:31.620
and that's the answer.
00:15:35.860 --> 00:15:39.250
Let's just take a look at what
some of these coefficients
00:15:39.250 --> 00:15:42.220
are for some really
simple functions.
00:15:42.220 --> 00:15:45.940
So there I've rewritten what
each of those coefficients
00:15:45.940 --> 00:15:48.160
is as an integral.
00:15:48.160 --> 00:15:50.600
And now let's consider
the following function.
00:15:50.600 --> 00:15:52.720
So let's say our function is 1.
00:15:52.720 --> 00:15:54.970
It's just a constant at 1.
00:15:54.970 --> 00:16:00.790
So you can see that this
integral from minus t over 2
00:16:00.790 --> 00:16:05.800
to t over 2, that integral is
just t multiplied by 2 over t
00:16:05.800 --> 00:16:09.790
gives that
coefficient as just 2.
00:16:09.790 --> 00:16:13.360
If our function is
cosine omega 0 t,
00:16:13.360 --> 00:16:17.320
you can see that if you put a
cosine in here, that averages
00:16:17.320 --> 00:16:18.610
to 0.
00:16:18.610 --> 00:16:22.270
If you put a cosine in here,
you get cosine squared.
00:16:22.270 --> 00:16:29.590
The integral of cosine
squared is just half
00:16:29.590 --> 00:16:31.970
of basically the full range.
00:16:31.970 --> 00:16:33.460
So that's just t over 2.
00:16:33.460 --> 00:16:35.470
When you multiply by
2 over t, you get 1.
00:16:38.010 --> 00:16:42.030
And the coefficient a2 for
a function cosine omega t
00:16:42.030 --> 00:16:45.690
is 0, because the integral
of cosine omega 0 t times
00:16:45.690 --> 00:16:47.550
cosine 2 omega 0 t is 0.
00:16:50.170 --> 00:16:50.800
All right.
00:16:50.800 --> 00:16:53.380
If we have a function
cosine 2 omega 0 t,
00:16:53.380 --> 00:16:57.176
then these coefficients are
0, and that coefficient is 1.
00:16:57.176 --> 00:17:00.460
You can see that you have
this interesting thing here.
00:17:00.460 --> 00:17:03.910
If your function is
cosine omega 0 t,
00:17:03.910 --> 00:17:07.450
then the only coefficient
that's non-zero
00:17:07.450 --> 00:17:10.250
is the one that you're
overlapping with cosine omega 0
00:17:10.250 --> 00:17:10.750
t.
00:17:10.750 --> 00:17:14.170
It's only this first
coefficient that's non-zero.
00:17:14.170 --> 00:17:18.069
If your function has a
frequency 2 omega 0 t,
00:17:18.069 --> 00:17:21.025
then the only coefficient
that's non-zero is the a2.
00:17:24.520 --> 00:17:28.349
So what that means is
that if the function has
00:17:28.349 --> 00:17:32.220
maximal overlap, if it overlaps
one of those cosines, then
00:17:32.220 --> 00:17:34.490
it has 0 overlap
with all the others.
00:17:37.450 --> 00:17:40.570
And we can say that set
of cosine functions,
00:17:40.570 --> 00:17:44.370
cosine omega 0 t,
cosine 2 omega 0 t,
00:17:44.370 --> 00:17:46.840
forms what's called an
orthogonal basis set.
00:17:46.840 --> 00:17:50.610
We're going to spend a lot of
time talking about basis set
00:17:50.610 --> 00:17:52.890
later, but I'm just going
to throw this word out
00:17:52.890 --> 00:17:55.380
to you so that
you've heard it when
00:17:55.380 --> 00:17:58.200
I come back to the idea
of basis sets later.
00:17:58.200 --> 00:18:01.690
You're going to see
this connection.
00:18:01.690 --> 00:18:04.600
So the basic idea is
that what we're doing
00:18:04.600 --> 00:18:08.630
is we're taking our
signal, which is a vector.
00:18:08.630 --> 00:18:11.420
It's a set of points in time.
00:18:11.420 --> 00:18:15.190
We can think of that as a vector
in a high dimensional space.
00:18:15.190 --> 00:18:20.950
And we're simply expressing it
in a new basis set of cosines
00:18:20.950 --> 00:18:22.370
of different frequencies.
00:18:22.370 --> 00:18:25.750
So each of those functions,
cosine n omega t,
00:18:25.750 --> 00:18:29.140
is like a vector in a basis set.
00:18:29.140 --> 00:18:31.960
Our signal like a vector.
00:18:31.960 --> 00:18:36.130
And what we're doing is when
we're doing these projections,
00:18:36.130 --> 00:18:38.320
we're simply computing
the projection
00:18:38.320 --> 00:18:42.670
of that vector, our signal,
onto these different basis
00:18:42.670 --> 00:18:45.940
functions, these
different basis vectors.
00:18:45.940 --> 00:18:51.790
So we're just finding
the coefficient
00:18:51.790 --> 00:18:55.210
so that we can
express our signal
00:18:55.210 --> 00:18:58.420
as a sum of a coefficient
times a basis vector
00:18:58.420 --> 00:19:02.690
plus another coefficient times
another basis vector and so on.
00:19:02.690 --> 00:19:05.410
So for example, in the
simple standard basis
00:19:05.410 --> 00:19:10.090
where this vector is 0 1
and that vector is 1 0,
00:19:10.090 --> 00:19:12.550
you can write down
an arbitrary vector
00:19:12.550 --> 00:19:18.010
as a coefficient times this plus
another coefficient times that.
00:19:18.010 --> 00:19:20.750
That make sense?
00:19:20.750 --> 00:19:22.370
And how do we find
those coefficients?
00:19:22.370 --> 00:19:25.340
We just take our
vector and dot it
00:19:25.340 --> 00:19:28.790
onto each one of these
basis vectors, x2.
00:19:28.790 --> 00:19:29.870
Does that make sense?
00:19:32.710 --> 00:19:36.230
You don't need to know
this for this section,
00:19:36.230 --> 00:19:38.210
but we're going to
come back to this.
00:19:38.210 --> 00:19:40.870
I would like you to
eventually kind of combine
00:19:40.870 --> 00:19:47.110
these views of taking signals
and looking at projections
00:19:47.110 --> 00:19:50.170
of those into new basis sets.
00:19:50.170 --> 00:19:54.750
And as you know, how
you see things depends
00:19:54.750 --> 00:19:58.140
on how you're looking at
them, the direction that you
00:19:58.140 --> 00:19:58.840
look at them.
00:19:58.840 --> 00:19:59.840
That's what we're doing.
00:19:59.840 --> 00:20:03.220
When we take a signal and we
project it onto a function,
00:20:03.220 --> 00:20:06.060
we're taking a particular
view of that function.
00:20:09.960 --> 00:20:22.760
So as you know, the view
you have on something
00:20:22.760 --> 00:20:26.130
has a big impact
on what you see.
00:20:26.130 --> 00:20:26.630
Right?
00:20:34.240 --> 00:20:37.810
So that's all we're doing
is we're taking functions
00:20:37.810 --> 00:20:41.590
and finding the
projection on which we
00:20:41.590 --> 00:20:45.010
can see something interesting.
00:20:45.010 --> 00:20:46.000
That's it.
00:20:46.000 --> 00:20:48.280
That's all spectral analysis is.
00:20:48.280 --> 00:20:51.190
And the particular
views we're looking at
00:20:51.190 --> 00:20:55.510
are projections onto
different periodic functions.
00:20:55.510 --> 00:20:57.700
Cosines of different
frequencies.
00:20:57.700 --> 00:20:58.270
All right?
00:20:58.270 --> 00:21:00.980
And what you find is that
for periodic signals,
00:21:00.980 --> 00:21:04.450
there are certain views where
something magically pops out
00:21:04.450 --> 00:21:08.020
and you see what's there that
you can't see when you just
00:21:08.020 --> 00:21:11.340
look at the time domain.
00:21:11.340 --> 00:21:14.020
All right.
00:21:14.020 --> 00:21:17.960
So we looked at even functions
or symmetric functions.
00:21:17.960 --> 00:21:20.740
Now let's take a
look at odd functions
00:21:20.740 --> 00:21:22.150
are antisymmetric functions.
00:21:22.150 --> 00:21:27.100
These are called odd because
the odd polynomials like x cubed
00:21:27.100 --> 00:21:28.100
looks like this.
00:21:28.100 --> 00:21:29.920
If it's negative
on one side, it's
00:21:29.920 --> 00:21:31.070
positive on the other side.
00:21:31.070 --> 00:21:31.570
Same here.
00:21:31.570 --> 00:21:34.630
If it's negative here,
then it's positive there.
00:21:34.630 --> 00:21:40.810
So we can now write down Fourier
series for odd or antisymmetric
00:21:40.810 --> 00:21:41.600
functions.
00:21:41.600 --> 00:21:43.142
What do you think
we're going to use?
00:21:43.142 --> 00:21:46.700
Instead of cosines, we're going
to use sines, because sines
00:21:46.700 --> 00:21:50.860
are symmetric around--
00:21:50.860 --> 00:21:52.760
antisymmetric around the origin.
00:21:52.760 --> 00:21:54.760
And we're still going to
consider functions that
00:21:54.760 --> 00:21:56.740
are periodic with period t.
00:21:56.740 --> 00:21:59.170
We can take any
antisymmetric function
00:21:59.170 --> 00:22:05.020
and approximate it as a sum
of sine waves of frequency 2
00:22:05.020 --> 00:22:08.770
pi over t or, again, omega 0.
00:22:08.770 --> 00:22:11.650
And integer multiples
of that omega 0.
00:22:14.740 --> 00:22:15.240
All right.
00:22:15.240 --> 00:22:18.840
So again, our odd functions
can be approximated
00:22:18.840 --> 00:22:23.810
as a sum of components,
contributions
00:22:23.810 --> 00:22:28.150
of different frequencies
with a coefficient times
00:22:28.150 --> 00:22:31.010
sine of omega 0 t plus
another coefficient times
00:22:31.010 --> 00:22:34.130
sine of 2 omega 0 t and so on.
00:22:34.130 --> 00:22:36.640
And we can write that as a
sum that looks like this.
00:22:36.640 --> 00:22:40.990
So a sum over n from 1 to
infinity of coefficient b
00:22:40.990 --> 00:22:46.380
sub n times sine of n omega 0 t.
00:22:46.380 --> 00:22:48.120
And why is there
no DC term here?
00:22:51.018 --> 00:22:51.990
Good.
00:22:51.990 --> 00:22:55.390
Because an antisymmetric
function can't have a DC
00:22:55.390 --> 00:22:55.890
offset.
00:22:59.550 --> 00:23:05.760
So for arbitrary functions, you
can write down any arbitrary
00:23:05.760 --> 00:23:10.520
periodic function as the
sum of a symmetric part
00:23:10.520 --> 00:23:12.000
and an antisymmetric part.
00:23:12.000 --> 00:23:13.620
So we can write
down an arbitrary
00:23:13.620 --> 00:23:19.980
function as a sum
of these cosines
00:23:19.980 --> 00:23:21.750
plus a sum of sine waves.
00:23:26.280 --> 00:23:27.690
So that's Fourier series.
00:23:27.690 --> 00:23:28.740
Any questions about that?
00:23:33.010 --> 00:23:35.650
So this is kind of messy.
00:23:35.650 --> 00:23:41.170
And it turns out that there's a
much simpler way of writing out
00:23:41.170 --> 00:23:46.700
functions as sums of
periodic functions.
00:23:46.700 --> 00:23:48.860
So rather than using
cosines and sines,
00:23:48.860 --> 00:23:51.830
we're going to use
complex exponentials.
00:23:51.830 --> 00:23:56.270
And that is what complex
Fourier series does.
00:23:56.270 --> 00:23:57.590
All right, so let's do that.
00:23:57.590 --> 00:24:02.660
So you probably recall
that you can write down
00:24:02.660 --> 00:24:10.200
a complex exponential e to the
i omega t as a cosine omega
00:24:10.200 --> 00:24:13.940
t plus i sine omega t.
00:24:13.940 --> 00:24:17.760
So e to the i omega t
is just a generalization
00:24:17.760 --> 00:24:19.890
of sines and cosines.
00:24:19.890 --> 00:24:21.950
So the way to
think about this is
00:24:21.950 --> 00:24:24.970
e to the i omega t
is a complex number.
00:24:24.970 --> 00:24:27.120
If we plot it in a
complex plane where
00:24:27.120 --> 00:24:29.910
we look at the real
part along this axis,
00:24:29.910 --> 00:24:33.840
the imaginary part along
that axis, e to the i omega
00:24:33.840 --> 00:24:36.060
t just lives on this circle.
00:24:36.060 --> 00:24:40.870
No matter what omega t is,
e to the i omega t just
00:24:40.870 --> 00:24:43.870
sits on this circle in the
complex plane, the unit
00:24:43.870 --> 00:24:47.670
circle in the complex plane.
00:24:47.670 --> 00:24:53.200
e to the i omega t is
a function of time.
00:24:53.200 --> 00:24:58.400
It simply has a real part
that looks like cosine.
00:24:58.400 --> 00:25:05.960
So the real part of this as you
increase t or the phase omega t
00:25:05.960 --> 00:25:11.330
is the real part just oscillates
sinusoidally back and forth
00:25:11.330 --> 00:25:14.090
like this as a cosine.
00:25:14.090 --> 00:25:18.210
The imaginary part just
oscillates back and forth
00:25:18.210 --> 00:25:20.700
as a sine.
00:25:20.700 --> 00:25:22.890
And when you put them
together, something
00:25:22.890 --> 00:25:25.770
that goes back and forth
this way as a cosine
00:25:25.770 --> 00:25:29.970
and up and down that way as a
sine just traces out a circle.
00:25:29.970 --> 00:25:33.850
So e to the i omega traces out
a circle in this direction,
00:25:33.850 --> 00:25:37.020
and as time increases, it
just goes around and around
00:25:37.020 --> 00:25:37.950
like this.
00:25:37.950 --> 00:25:41.580
E to the minus i omega t
just goes the other way.
00:25:44.110 --> 00:25:46.130
That make sense?
00:25:46.130 --> 00:25:50.630
Got the real part that's going
like this, the imaginary part
00:25:50.630 --> 00:25:53.810
that's going like this.
00:25:53.810 --> 00:25:55.910
And you put those
together and they just
00:25:55.910 --> 00:25:58.530
go around in a circle.
00:25:58.530 --> 00:26:03.010
So you can see it's a
way of combining cosine
00:26:03.010 --> 00:26:04.640
and sine together
in one function.
00:26:07.003 --> 00:26:08.420
So what we're going
to do is we're
00:26:08.420 --> 00:26:13.820
going to rewrite our Fourier
series as instead of sines
00:26:13.820 --> 00:26:15.320
and cosines, we're
going to stick
00:26:15.320 --> 00:26:17.750
in e to the-- we're going
to replace the sines
00:26:17.750 --> 00:26:22.350
and cosines with e to the i
omega t and e to the minus i
00:26:22.350 --> 00:26:22.940
omega t.
00:26:22.940 --> 00:26:29.860
So we're just going to solve
these two functions for cosine
00:26:29.860 --> 00:26:32.650
and sine, and we're going
to take this and plug it
00:26:32.650 --> 00:26:36.382
into our Fourier series
and see what we get.
00:26:36.382 --> 00:26:37.090
So let's do that.
00:26:37.090 --> 00:26:40.600
And remember, 1 over
i is just minus i.
00:26:44.570 --> 00:26:47.030
So here's our Fourier
series with our sum
00:26:47.030 --> 00:26:48.723
of cosines, our sum of sines.
00:26:48.723 --> 00:26:50.390
We're just going to
replace those things
00:26:50.390 --> 00:26:53.510
with the e to the i omega
t plus e to the minus
00:26:53.510 --> 00:26:55.260
i omega t and so on.
00:26:55.260 --> 00:26:56.150
So there we go.
00:26:56.150 --> 00:26:57.200
Just replacing that.
00:26:57.200 --> 00:27:00.010
There's a 1/2 there.
00:27:00.010 --> 00:27:02.940
And now we're just going
to do some algebra.
00:27:02.940 --> 00:27:06.690
And we're going to collect
either the i omega t's and e to
00:27:06.690 --> 00:27:09.658
the minus i omega t's together.
00:27:09.658 --> 00:27:10.950
And this is what it looks like.
00:27:13.950 --> 00:27:18.120
So you can see that
what we're doing
00:27:18.120 --> 00:27:21.270
is collecting this
into a bunch of terms
00:27:21.270 --> 00:27:24.600
that have e to the
positive in omega
00:27:24.600 --> 00:27:31.080
t here and e to the
minus in omega 0 t there.
00:27:31.080 --> 00:27:34.530
And now we have still
a sum of three things.
00:27:34.530 --> 00:27:40.060
So it doesn't really look like
we've really gotten anywhere.
00:27:40.060 --> 00:27:42.850
But notice something.
00:27:42.850 --> 00:27:47.692
If we just put the
minus sign into the n,
00:27:47.692 --> 00:27:51.130
then we can combine
these two into one sum.
00:27:51.130 --> 00:27:58.300
And this, if n is 0, what
is e to the in omega t?
00:27:58.300 --> 00:27:59.920
It's just 1.
00:27:59.920 --> 00:28:04.000
So we can also write this as
something e to the in omega t
00:28:04.000 --> 00:28:06.820
as long as n is 0.
00:28:06.820 --> 00:28:07.990
So that's what we do.
00:28:07.990 --> 00:28:10.870
Oh, and by the way,
these coefficients here
00:28:10.870 --> 00:28:16.650
we can just rewrite as sums of
those coefficients up there.
00:28:16.650 --> 00:28:17.680
Don't worry.
00:28:17.680 --> 00:28:19.150
This all looks
really complicated.
00:28:19.150 --> 00:28:21.700
By the end, it's just boiled
down to one simple thing.
00:28:21.700 --> 00:28:23.050
That's why we're doing this.
00:28:23.050 --> 00:28:24.220
We're simplifying things.
00:28:26.820 --> 00:28:30.900
So when you do this,
when you rewrite this,
00:28:30.900 --> 00:28:34.200
this looks like a
sum over n equals 0.
00:28:34.200 --> 00:28:38.100
This is a sum over positive
n, n equals 1 to infinity.
00:28:38.100 --> 00:28:42.360
This is a sum over negative
n, minus 1 to minus infinity.
00:28:42.360 --> 00:28:47.130
And all those
combine into one sum.
00:28:47.130 --> 00:28:50.400
So now we can write
down any function y of t
00:28:50.400 --> 00:28:53.760
as a sum over n
equals minus infinity
00:28:53.760 --> 00:28:59.310
to infinity of a coefficient a
sub n times e to the in omega.
00:29:01.960 --> 00:29:06.730
So we went from having this
complicated thing, this sum
00:29:06.730 --> 00:29:10.360
over our constant terms,
sines, and cosines,
00:29:10.360 --> 00:29:15.060
and we boiled it
down to a single sum.
00:29:15.060 --> 00:29:20.910
That's why these complex
exponentials are useful.
00:29:20.910 --> 00:29:22.680
Because we don't
have to carry around
00:29:22.680 --> 00:29:26.550
a bunch of different functions,
different basis functions
00:29:26.550 --> 00:29:32.030
to describe an
arbitrary signal y.
00:29:32.030 --> 00:29:35.270
But remember, this is
just a mathematical trick
00:29:35.270 --> 00:29:36.380
to hide sines and cosines.
00:29:40.300 --> 00:29:44.525
A very powerful trick,
but that's all it's doing.
00:29:44.525 --> 00:29:45.775
It's hiding sines and cosines.
00:29:48.420 --> 00:29:49.830
All right.
00:29:49.830 --> 00:29:53.490
So we've replaced our sums
over coastlines and signs
00:29:53.490 --> 00:29:56.570
with a sum of
complex exponentials.
00:29:56.570 --> 00:29:57.740
All right.
00:29:57.740 --> 00:30:00.270
Remember what we're doing here.
00:30:00.270 --> 00:30:07.550
We're finding a new way
of writing down functions.
00:30:07.550 --> 00:30:09.800
So what's cool
about this, what's
00:30:09.800 --> 00:30:13.680
really interesting about this,
is that for some functions--
00:30:13.680 --> 00:30:16.430
so what we're doing is we
have an arbitrary function y.
00:30:16.430 --> 00:30:21.680
And we're writing a down with
just some numbers a sub n.
00:30:21.680 --> 00:30:26.530
And what's cool about this
is that for some functions y,
00:30:26.530 --> 00:30:29.380
you can describe that
function with just a few
00:30:29.380 --> 00:30:33.085
of these coefficients a.
00:30:33.085 --> 00:30:34.540
Does that make sense?
00:30:34.540 --> 00:30:36.160
So let me just
show you an example
00:30:36.160 --> 00:30:38.600
of some functions
that look really,
00:30:38.600 --> 00:30:41.740
really simple when
you rewrite them
00:30:41.740 --> 00:30:44.320
using these coefficients a.
00:30:44.320 --> 00:30:46.250
So here's an example.
00:30:46.250 --> 00:30:53.100
So here's a function of
n that has three numbers.
00:30:53.100 --> 00:30:58.380
a sub minus 1, n equals
minus 1 is 1/2, a sub 0 is 0,
00:30:58.380 --> 00:31:00.480
and a sub 1 is 1/2.
00:31:00.480 --> 00:31:01.950
And all the rest of them are 0.
00:31:01.950 --> 00:31:07.610
So really, we only have two
non-zero entries in this sum.
00:31:07.610 --> 00:31:10.530
So what function is that?
00:31:10.530 --> 00:31:12.480
It's just a cosine.
00:31:12.480 --> 00:31:15.630
So we have-- let's
write this out.
00:31:15.630 --> 00:31:18.550
Y equals a sum over
all of these things.
00:31:18.550 --> 00:31:21.930
1/2 e to the minus--
00:31:21.930 --> 00:31:27.730
the first n is minus 1. e to
the minus i omega 0 t plus 1/2 e
00:31:27.730 --> 00:31:29.850
to the plus i omega 0 t.
00:31:29.850 --> 00:31:32.160
We're just writing out that sum.
00:31:32.160 --> 00:31:33.327
And that is just--
00:31:37.660 --> 00:31:41.650
sorry, I didn't tell you
what that equation was.
00:31:41.650 --> 00:31:46.330
That's Euler's equation.
00:31:46.330 --> 00:31:49.150
That's just cosine
minus i sine omega t.
00:31:49.150 --> 00:31:51.910
That is just cosine
plus i sine omega t.
00:31:51.910 --> 00:31:52.945
The sines cancel.
00:31:55.630 --> 00:31:57.930
And you're left with
cosine omega 0 t.
00:32:00.890 --> 00:32:06.200
So here's this function of
time that goes on infinitely.
00:32:06.200 --> 00:32:10.970
If you wanted to write down all
the values of cosine omega 0 t,
00:32:10.970 --> 00:32:14.130
you'd have to write down
an awful lot of numbers.
00:32:14.130 --> 00:32:17.735
And here we can write down that
same function with two numbers.
00:32:23.700 --> 00:32:30.630
So this is a very compact
view of that function of time.
00:32:36.150 --> 00:32:37.890
Here's another function.
00:32:37.890 --> 00:32:40.010
What function do
you think that is?
00:32:42.700 --> 00:32:48.780
What would be the time
domain equivalent of this set
00:32:48.780 --> 00:32:54.050
of Fourier coefficients?
00:32:54.050 --> 00:32:54.590
Good.
00:32:54.590 --> 00:32:56.090
So we're going to
do the same thing.
00:32:56.090 --> 00:32:57.630
Just write it out.
00:32:57.630 --> 00:32:59.370
All these sums are 0.
00:32:59.370 --> 00:33:02.400
All these components are
0 except for two of them.
00:33:02.400 --> 00:33:05.985
n equals minus 2
and n equals plus 2.
00:33:05.985 --> 00:33:08.010
You just put those
in there as 1/2
00:33:08.010 --> 00:33:18.560
e to the minus 2 omega 0 t plus
1/2 e to the plus 2 omega 0 t.
00:33:18.560 --> 00:33:22.490
And that is just if you write
that out, those sines cancel,
00:33:22.490 --> 00:33:24.770
and you have cosine 2 omega 0 t.
00:33:24.770 --> 00:33:27.500
Pretty simple, right?
00:33:27.500 --> 00:33:30.240
How about this one?
00:33:30.240 --> 00:33:34.070
This is the-- remember, the
a's are complex numbers.
00:33:34.070 --> 00:33:38.020
The ones we were looking at
here had two real numbers.
00:33:38.020 --> 00:33:42.920
Here's an example where
the a's are imaginary.
00:33:42.920 --> 00:33:44.570
One is i over 2.
00:33:44.570 --> 00:33:47.920
One is minus i over 2.
00:33:47.920 --> 00:33:53.230
That's what the complex
Fourier representation
00:33:53.230 --> 00:33:56.530
looks like of this function.
00:33:56.530 --> 00:33:59.090
We can just plug it in here.
00:33:59.090 --> 00:34:03.410
You solve that, you can
see that in this case,
00:34:03.410 --> 00:34:06.350
the cosines cancel,
because this is i over 2
00:34:06.350 --> 00:34:10.429
cosine 2 omega t minus i
over 2 cosine 2 omega t.
00:34:10.429 --> 00:34:15.170
Those cancel and you're
left with sine 2 omega 0 t.
00:34:15.170 --> 00:34:20.600
So that is what Fourier
representation of sine 2 omega
00:34:20.600 --> 00:34:22.940
t looks like.
00:34:22.940 --> 00:34:26.080
So the functions that
have higher frequencies
00:34:26.080 --> 00:34:32.409
will have non-zero elements
that are further out in n.
00:34:37.639 --> 00:34:38.810
Any questions about that?
00:34:45.370 --> 00:34:50.639
So again, this set of
functions e to the in omega 0 t
00:34:50.639 --> 00:34:57.730
form an orthogonal, orthonormal
basis set over that [INAUDIBLE]
00:34:57.730 --> 00:34:59.253
over that interval.
00:34:59.253 --> 00:35:03.830
The a0 coefficient is
just the projection
00:35:03.830 --> 00:35:08.060
of our function onto e to the 0.
00:35:08.060 --> 00:35:09.530
n equals 0.
00:35:09.530 --> 00:35:10.760
And that's just the average.
00:35:13.690 --> 00:35:17.550
The a1 coefficient is just
the projection of our function
00:35:17.550 --> 00:35:21.770
e to the minus i omega 0 t.
00:35:21.770 --> 00:35:24.540
And in general, the
m-th coefficient
00:35:24.540 --> 00:35:28.250
is just the projection
of our function onto e
00:35:28.250 --> 00:35:30.770
to the minus im omega 0 t.
00:35:36.310 --> 00:35:39.910
And we can take
those coefficients,
00:35:39.910 --> 00:35:45.220
plug them into this sum,
and reconstruct an arbitrary
00:35:45.220 --> 00:35:49.420
periodic function, this y of t.
00:35:49.420 --> 00:35:51.970
So we have a way of
taking a function
00:35:51.970 --> 00:35:56.260
and getting these complex
Fourier coefficients.
00:35:56.260 --> 00:35:59.590
And we have a way of
taking those coefficients
00:35:59.590 --> 00:36:03.230
and reconstructing our function.
00:36:03.230 --> 00:36:10.090
This is just a bunch of
different views function y.
00:36:10.090 --> 00:36:12.130
And from all of those
different views,
00:36:12.130 --> 00:36:16.000
we can reconstruct our function.
00:36:16.000 --> 00:36:17.960
That's all it is.
00:36:17.960 --> 00:36:24.830
So in general, when we
do Fourier decomposition
00:36:24.830 --> 00:36:28.880
in a computer in
MATLAB on real signals
00:36:28.880 --> 00:36:31.730
that you've sampled
in time, it's
00:36:31.730 --> 00:36:37.780
always done in this kind
of discrete representation.
00:36:37.780 --> 00:36:41.140
You've got, in this case,
discrete frequencies.
00:36:41.140 --> 00:36:42.970
When you sample
signals, you've got
00:36:42.970 --> 00:36:47.470
functions that are discrete in
time, and this becomes a sum.
00:36:47.470 --> 00:36:49.600
But before we go to
the discrete case,
00:36:49.600 --> 00:36:51.070
I just want to
show you what this
00:36:51.070 --> 00:36:55.220
looks like when we go to the
case of arbitrary functions.
00:36:55.220 --> 00:36:57.790
Remember, this thing
was about representing
00:36:57.790 --> 00:36:59.260
periodic functions.
00:36:59.260 --> 00:37:01.630
You can only represent
periodic functions
00:37:01.630 --> 00:37:05.140
using these Fourier series.
00:37:05.140 --> 00:37:08.830
But before we go on to the
Fourier transform algorithm
00:37:08.830 --> 00:37:10.840
and discrete Fourier
transforms, I just
00:37:10.840 --> 00:37:13.960
want to show you what this looks
like for the case of arbitrary
00:37:13.960 --> 00:37:15.930
functions.
00:37:15.930 --> 00:37:18.270
And I'm just
showing this to you.
00:37:18.270 --> 00:37:21.160
I don't expect you to be able
to reproduce any of this.
00:37:21.160 --> 00:37:24.220
But you should see what it
looks like, for those of you who
00:37:24.220 --> 00:37:27.240
haven't seen it already.
00:37:27.240 --> 00:37:29.700
So what we're going to
do is go from the case
00:37:29.700 --> 00:37:32.533
of periodic functions to
non-periodic functions.
00:37:32.533 --> 00:37:34.200
And the simplest way
to think about that
00:37:34.200 --> 00:37:36.840
is a periodic function
does something here,
00:37:36.840 --> 00:37:39.240
and then it just does
the same thing here,
00:37:39.240 --> 00:37:42.060
and then it just does
the same thing here.
00:37:42.060 --> 00:37:48.160
So how do we go from this
to an arbitrary function?
00:37:48.160 --> 00:37:53.084
Well, we're just going to let
the period go to infinity.
00:37:53.084 --> 00:37:55.440
Does that make sense?
00:37:55.440 --> 00:37:57.090
That's actually pretty easy.
00:37:57.090 --> 00:37:59.610
We're going to let t
go to infinity, which
00:37:59.610 --> 00:38:06.990
means the frequencies, which
are 2 pi omega 0 or 2 pi over t,
00:38:06.990 --> 00:38:09.480
that's going to go to 0.
00:38:09.480 --> 00:38:11.910
So our steps.
00:38:11.910 --> 00:38:14.220
Remember when we had this
discrete Fourier transform
00:38:14.220 --> 00:38:20.310
here, we had these steps in
frequency as a function of n.
00:38:20.310 --> 00:38:24.100
Those steps are just going to
get infinitely close together,
00:38:24.100 --> 00:38:26.780
the different frequency bins.
00:38:26.780 --> 00:38:28.740
So that's what we're
going to do now.
00:38:28.740 --> 00:38:31.870
You're just going to let
those frequency steps go to 0.
00:38:31.870 --> 00:38:36.130
And now frequency,
in discrete case,
00:38:36.130 --> 00:38:42.730
the frequency is just that
number, that n times omega 0.
00:38:42.730 --> 00:38:44.290
m times omega 0.
00:38:44.290 --> 00:38:49.180
Well, omega 0 is going to 0, but
the m's are getting really big.
00:38:49.180 --> 00:38:51.070
So we can just change--
00:38:51.070 --> 00:38:52.570
we're just going
to call that omega.
00:38:57.350 --> 00:38:59.405
The omega 0's are
going to 0, so the m's
00:38:59.405 --> 00:39:00.530
are getting infinitely big.
00:39:00.530 --> 00:39:03.500
So we can't really
use m anymore or n
00:39:03.500 --> 00:39:05.635
to label our frequency steps.
00:39:05.635 --> 00:39:07.010
So we're just
going to use omega.
00:39:10.160 --> 00:39:12.320
We used to call
our coefficients,
00:39:12.320 --> 00:39:16.370
our Fourier coefficients, we
used to label them with m.
00:39:16.370 --> 00:39:20.030
We can't use m anymore, because
m is getting infinitely big.
00:39:20.030 --> 00:39:22.550
So we use this new label omega.
00:39:22.550 --> 00:39:27.200
So a sub m becomes a new
variable, our Fourier
00:39:27.200 --> 00:39:33.330
transform, labeled by
the frequency omega.
00:39:33.330 --> 00:39:38.220
And we're just going
to basically just make
00:39:38.220 --> 00:39:39.600
those replacements in here.
00:39:39.600 --> 00:39:44.290
So the coefficients become
a function of frequency.
00:39:44.290 --> 00:39:45.630
That's just an integral.
00:39:45.630 --> 00:39:47.910
Remember, t is going
to infinity now.
00:39:47.910 --> 00:39:50.070
So this has to go
from minus infinity
00:39:50.070 --> 00:39:56.940
to infinity of our function
y times our basis function.
00:39:56.940 --> 00:39:59.640
And instead of e to
the im omega 0 t,
00:39:59.640 --> 00:40:02.970
we just replace m
omega 0 with omega.
00:40:02.970 --> 00:40:06.060
So e to the minus i omega t.
00:40:06.060 --> 00:40:10.420
And that is the
Fourier transform.
00:40:10.420 --> 00:40:13.880
And we're just going to do
the same replacement here,
00:40:13.880 --> 00:40:19.990
but instead of summing over
n going from minus infinity
00:40:19.990 --> 00:40:23.050
to infinity, we have to write
this as an integral as well.
00:40:23.050 --> 00:40:25.690
And so that we can
reconstruct our function
00:40:25.690 --> 00:40:31.780
y of t as an integral of
our Fourier coefficients
00:40:31.780 --> 00:40:36.190
times the e to the i omega t.
00:40:36.190 --> 00:40:37.590
See that?
00:40:37.590 --> 00:40:38.958
It's essentially the same thing.
00:40:38.958 --> 00:40:41.250
It's just that we're turning
this sum into an integral.
00:40:46.240 --> 00:40:46.740
All right.
00:40:46.740 --> 00:40:49.240
So that's called a
Fourier transform.
00:40:49.240 --> 00:40:51.700
And that's the inverse Fourier
transform, this [INAUDIBLE]
00:40:51.700 --> 00:40:54.850
from a function to
Fourier coefficients.
00:40:54.850 --> 00:40:56.680
And this takes your
Fourier coefficients
00:40:56.680 --> 00:40:58.000
and goes back to your function.
00:41:02.880 --> 00:41:04.740
All right, good.
00:41:04.740 --> 00:41:07.870
Let me just show you
a few simple examples.
00:41:07.870 --> 00:41:12.250
So let's start with the
function y of t equals 1.
00:41:12.250 --> 00:41:14.730
So it's just a constant.
00:41:14.730 --> 00:41:16.050
What is the Fourier transform?
00:41:16.050 --> 00:41:18.060
So let's plug this into here.
00:41:20.730 --> 00:41:24.120
Does anyone know what
that integral looks
00:41:24.120 --> 00:41:29.570
like of the integral from
minus infinity to infinity
00:41:29.570 --> 00:41:37.125
of e the minus i omega t
dt integrating over time.
00:41:37.125 --> 00:41:39.450
It's a delta function.
00:41:39.450 --> 00:41:46.350
There's only one value of omega
for which that function is not
00:41:46.350 --> 00:41:46.850
0.
00:41:46.850 --> 00:41:51.792
Remember, so let's say omega
equals 1, 1-- you know,
00:41:51.792 --> 00:41:53.340
1 hertz.
00:41:53.340 --> 00:41:55.380
This is just a bunch
of sines and cosines.
00:41:55.380 --> 00:42:00.870
So when you integrate over
sines and cosines, you get 0.
00:42:00.870 --> 00:42:04.770
Integral over time
of cosine is just 0.
00:42:04.770 --> 00:42:08.840
But if omega is 0, then
what is e to the i omega t?
00:42:12.850 --> 00:42:15.850
e to the i 0 is 1.
00:42:15.850 --> 00:42:20.860
And so we're integrating
over 1 times dt.
00:42:20.860 --> 00:42:24.675
And that becomes infinity
at omega equals 0.
00:42:24.675 --> 00:42:26.050
And that's a delta
function, it's
00:42:26.050 --> 00:42:31.740
0 everywhere except 4 at 0.
00:42:31.740 --> 00:42:34.050
So that becomes
a delta function.
00:42:34.050 --> 00:42:39.990
This Fourier transform of a
constant is a delta function.
00:42:39.990 --> 00:42:41.710
And that's a really--
00:42:41.710 --> 00:42:44.080
it's a really good one to know.
00:42:44.080 --> 00:42:47.500
The Fourier transform of a
constant is a delta function.
00:42:47.500 --> 00:42:49.960
That's called a
Fourier transform pair.
00:42:49.960 --> 00:42:53.470
You have a function
and another function.
00:42:53.470 --> 00:42:55.152
One function is the
Fourier transform
00:42:55.152 --> 00:42:56.610
of the other function
that's called
00:42:56.610 --> 00:43:00.100
a Fourier transform pair.
00:43:00.100 --> 00:43:02.860
So the Fourier
transform of a constant
00:43:02.860 --> 00:43:05.820
is just a delta function at 0.
00:43:05.820 --> 00:43:07.860
You can invert that.
00:43:07.860 --> 00:43:11.370
If you integrate, let's just
plug that delta function
00:43:11.370 --> 00:43:12.000
into here.
00:43:12.000 --> 00:43:17.550
If you integrate delta function
times e to the i omega t,
00:43:17.550 --> 00:43:21.810
you just get e to the
i 0t, which is just 1.
00:43:24.680 --> 00:43:27.800
So we can take the
Fourier transform of 1,
00:43:27.800 --> 00:43:30.230
get a delta function,
[INAUDIBLE] inverse Fourier
00:43:30.230 --> 00:43:32.480
transform the delta
function, and get back 1.
00:43:35.010 --> 00:43:37.660
How about this
function right here?
00:43:37.660 --> 00:43:40.430
This function is e
to the i omega 1.
00:43:40.430 --> 00:43:44.550
It's a sine wave and a
cosine wave, a complex sine
00:43:44.550 --> 00:43:48.120
and cosine, at
frequency omega 1.
00:43:48.120 --> 00:43:51.508
Anybody know what the
Fourier transform of that is?
00:43:51.508 --> 00:43:53.620
AUDIENCE: [INAUDIBLE]
00:43:53.620 --> 00:43:54.370
MICHALE FEE: Yeah.
00:43:54.370 --> 00:44:03.730
So it's basically--
you can think of this--
00:44:03.730 --> 00:44:04.790
that's the right answer.
00:44:04.790 --> 00:44:07.370
Rather than try to explain
it, I'll just show you.
00:44:07.370 --> 00:44:11.450
So the Fourier transform of
this is just a peak at omega 1.
00:44:14.520 --> 00:44:17.220
And we can inverse Fourier
transform that and recover
00:44:17.220 --> 00:44:18.900
our original function.
00:44:18.900 --> 00:44:22.230
So those last few slides are
more for the aficionados.
00:44:22.230 --> 00:44:23.915
You don't have to know that.
00:44:23.915 --> 00:44:25.290
We're going to
spend time looking
00:44:25.290 --> 00:44:31.290
at the discrete versions
of these things.
00:44:31.290 --> 00:44:32.830
How about this case?
00:44:32.830 --> 00:44:35.400
This is a simple
case where you have
00:44:35.400 --> 00:44:38.940
a function that the
Fourier transform
00:44:38.940 --> 00:44:44.000
of which has a peak at omega
1 and a peak at minus omega 1.
00:44:44.000 --> 00:44:47.160
The Fourier transform of the
inverse Fourier transform
00:44:47.160 --> 00:44:50.970
of that is just cosine omega 1t.
00:44:50.970 --> 00:44:55.140
So a function, a cosine
function with frequency omega 1,
00:44:55.140 --> 00:44:59.340
has two peaks, one
at frequency omega 1
00:44:59.340 --> 00:45:04.310
and another one at
frequency minus omega 1.
00:45:04.310 --> 00:45:06.660
So that looks a
lot like the case
00:45:06.660 --> 00:45:10.170
we just talked about where
we had this complex Fourier
00:45:10.170 --> 00:45:11.040
series.
00:45:11.040 --> 00:45:16.140
And we had a peak at n equals
2 and another peak at n
00:45:16.140 --> 00:45:18.090
equals minus 2.
00:45:18.090 --> 00:45:21.660
And that function that gave
us that complex Fourier
00:45:21.660 --> 00:45:24.425
series was cosine 2 omega t.
00:45:24.425 --> 00:45:25.800
So that's just
what we have here.
00:45:25.800 --> 00:45:29.010
We have a peak in the
spectrum at omega 1,
00:45:29.010 --> 00:45:31.860
peak at minus omega
1, and that is
00:45:31.860 --> 00:45:34.350
the Fourier decomposition
of a function that
00:45:34.350 --> 00:45:36.930
is cosine omega 1t.
00:45:36.930 --> 00:45:39.050
So it's just like
what we saw before
00:45:39.050 --> 00:45:43.330
for the case of the
complex Fourier series.
00:45:46.040 --> 00:45:48.490
So that was Fourier transform.
00:45:48.490 --> 00:45:54.770
And now let's talk about the
discrete Fourier transform
00:45:54.770 --> 00:45:57.290
and the associated
algorithm for computing
00:45:57.290 --> 00:46:02.210
that very quickly called the
Fast Fourier Transform, or FFT.
00:46:02.210 --> 00:46:06.620
So you can see computing
these Fourier transforms,
00:46:06.620 --> 00:46:09.950
if you were to actually try
to compute Fourier transforms
00:46:09.950 --> 00:46:13.400
by taking a function,
multiplying it
00:46:13.400 --> 00:46:17.420
by these complex exponentials
like writing down
00:46:17.420 --> 00:46:22.510
the value of e to the i omega t
at a bunch of different omegas
00:46:22.510 --> 00:46:25.270
and a bunch of different
t's and then integrating
00:46:25.270 --> 00:46:32.930
that numerically, that would
take forever computationally.
00:46:32.930 --> 00:46:35.840
But it turns out that there's--
00:46:35.840 --> 00:46:38.090
so you have to
compute that integral
00:46:38.090 --> 00:46:42.590
over time for every omega
that you're interested in.
00:46:42.590 --> 00:46:46.670
It turns out really, really
fast algorithm that you
00:46:46.670 --> 00:46:48.170
can use for the
case where you've
00:46:48.170 --> 00:46:52.570
got functions that
are sampled in time
00:46:52.570 --> 00:46:56.890
and you want to extract the
frequencies of that signal
00:46:56.890 --> 00:46:59.350
at a discrete set
of frequencies.
00:47:03.890 --> 00:47:06.440
I'm going to switch
from using omega, which
00:47:06.440 --> 00:47:07.910
is very commonly
used when you're
00:47:07.910 --> 00:47:09.380
talking about
Fourier transforms,
00:47:09.380 --> 00:47:11.670
to just using f, the frequency.
00:47:11.670 --> 00:47:15.230
So it's just f is just 2 pi.
00:47:15.230 --> 00:47:18.410
So omega is 2 pi f.
00:47:18.410 --> 00:47:26.610
So here I'm just rewriting
the Fourier transform
00:47:26.610 --> 00:47:28.110
and the inverse
Fourier transform
00:47:28.110 --> 00:47:29.730
with f rather than omega.
00:47:29.730 --> 00:47:31.590
So we're going to
start using f's now
00:47:31.590 --> 00:47:35.010
for the discrete
Fourier transform case.
00:47:35.010 --> 00:47:36.760
And we're going to
consider the case where
00:47:36.760 --> 00:47:40.380
we have signals that are sampled
at regular intervals delta t.
00:47:40.380 --> 00:47:44.390
So here we have a
function of time y of t.
00:47:44.390 --> 00:47:48.600
And we're going to sample that
signal at regular intervals
00:47:48.600 --> 00:47:49.260
delta t.
00:47:49.260 --> 00:47:51.870
So this is delta t right here.
00:47:51.870 --> 00:47:53.820
That time interval there.
00:47:53.820 --> 00:47:58.500
So the sampling rate, the
sampling frequency, is just 1
00:47:58.500 --> 00:47:59.310
over delta t.
00:48:04.920 --> 00:48:10.300
So the way this works in
the fast Fourier transform
00:48:10.300 --> 00:48:13.150
algorithm is you just
take those samples
00:48:13.150 --> 00:48:17.970
and you put them into a
vector in MATLAB, just
00:48:17.970 --> 00:48:21.150
some one-dimensional array.
00:48:23.950 --> 00:48:29.650
And we're going to imagine
that our samples are
00:48:29.650 --> 00:48:32.320
acquired at different times.
00:48:32.320 --> 00:48:37.690
And let's [INAUDIBLE] minus
time step 8, minus 7, minus 6.
00:48:37.690 --> 00:48:40.930
Time step 0 is in the
middle up to time step 7.
00:48:40.930 --> 00:48:43.380
And we're going to say
that N is an even number.
00:48:43.380 --> 00:48:45.800
The fast Fourier
transform works much,
00:48:45.800 --> 00:48:48.220
much faster when N
is an even number,
00:48:48.220 --> 00:48:53.590
and it works even faster when
N is a multiple, a power of 2.
00:48:53.590 --> 00:48:55.530
So in this case,
we have 16 samples.
00:48:55.530 --> 00:48:56.950
It's 2 to the 4.
00:48:56.950 --> 00:49:05.500
Should usually try to make
your samples be a power of 2.
00:49:05.500 --> 00:49:08.650
The number of samples.
00:49:08.650 --> 00:49:14.110
So there is our function of time
sampled at regular intervals t.
00:49:19.240 --> 00:49:23.710
So you can see that the
t min, the minimum time,
00:49:23.710 --> 00:49:27.850
in this vector of sample
points in our function
00:49:27.850 --> 00:49:31.420
is minus N over 2 delta t.
00:49:31.420 --> 00:49:36.800
And that [INAUDIBLE] time is N
over 2 minus 1 times delta t.
00:49:42.650 --> 00:49:45.290
And that's what the
MATLAB code would
00:49:45.290 --> 00:49:51.624
look like to generate
an array of time values.
00:49:51.624 --> 00:49:52.810
Does that make sense?
00:49:56.260 --> 00:50:02.030
The FFT algorithm returns
the Fourier components
00:50:02.030 --> 00:50:06.250
of that function of time.
00:50:06.250 --> 00:50:09.070
And it returns the
Fourier components
00:50:09.070 --> 00:50:14.500
in a vector that has the
negative frequencies on one
00:50:14.500 --> 00:50:16.780
side and the
positive frequencies
00:50:16.780 --> 00:50:20.520
on the other side
and the constant term
00:50:20.520 --> 00:50:22.170
here in the middle.
00:50:26.640 --> 00:50:30.630
The minimum frequency is N
over 2 times delta F. Oh,
00:50:30.630 --> 00:50:34.890
I should say it returns the
Fourier components in steps
00:50:34.890 --> 00:50:38.040
of delta f where delta F is
the sampling rate divided
00:50:38.040 --> 00:50:40.500
by the number of time
steps that you put into it.
00:50:43.680 --> 00:50:45.470
Don't panic.
00:50:45.470 --> 00:50:47.280
This is just reference.
00:50:47.280 --> 00:50:51.980
I'm showing you how
you put the data in
00:50:51.980 --> 00:50:55.340
and how you get the data out.
00:50:55.340 --> 00:50:57.770
When you put data into
the Fourier transform
00:50:57.770 --> 00:51:00.840
algorithm, the
FFT algorithm, you
00:51:00.840 --> 00:51:03.630
put in data that's
sampled at times,
00:51:03.630 --> 00:51:07.140
and you have to know
what those times are.
00:51:07.140 --> 00:51:09.510
If you want to make
a plot of the data,
00:51:09.510 --> 00:51:13.660
you need to make an
array of time values.
00:51:13.660 --> 00:51:17.792
And they just go from
a t min to a t max.
00:51:17.792 --> 00:51:19.500
And there's a little
piece of MATLAB code
00:51:19.500 --> 00:51:23.150
that produces that
array of times for you.
00:51:25.660 --> 00:51:27.910
What you get back from
the Fourier transform,
00:51:27.910 --> 00:51:33.920
the FFT, an array of not
values of the function of time,
00:51:33.920 --> 00:51:38.620
but rather an array of
Fourier coefficients.
00:51:38.620 --> 00:51:42.010
Just like we stuck in into our--
00:51:42.010 --> 00:51:45.760
when we did the
complex Fourier series,
00:51:45.760 --> 00:51:47.710
we stuck in a function of time.
00:51:47.710 --> 00:51:51.160
And we get out a list
of Fourier coefficients.
00:51:51.160 --> 00:51:52.460
Same thing here.
00:51:52.460 --> 00:51:58.280
We put in a function
of time, and we get out
00:51:58.280 --> 00:51:59.390
Fourier coefficients.
00:51:59.390 --> 00:52:04.550
And the Fourier coefficients
are complex numbers associated
00:52:04.550 --> 00:52:07.910
with different frequencies.
00:52:07.910 --> 00:52:10.940
So let's say the
middle coefficient
00:52:10.940 --> 00:52:13.280
that you get will
be the coefficient
00:52:13.280 --> 00:52:15.530
for the constant term.
00:52:15.530 --> 00:52:17.870
This coefficient down here
will be the coefficient
00:52:17.870 --> 00:52:20.840
for the minimum frequency,
and that coefficient
00:52:20.840 --> 00:52:23.480
will be the coefficient for
the maximum frequency, the most
00:52:23.480 --> 00:52:24.858
positive frequency.
00:52:29.470 --> 00:52:30.345
Does that make sense?
00:52:34.504 --> 00:52:37.920
AUDIENCE: [INAUDIBLE]
00:52:37.920 --> 00:52:40.010
MICHALE FEE: Ah, OK.
00:52:40.010 --> 00:52:44.320
So I was hoping to just kind
of skip over that for now.
00:52:44.320 --> 00:52:47.750
But when you do a discrete
Fourier transform,
00:52:47.750 --> 00:52:51.380
turns out that the coefficient
for the most negative frequency
00:52:51.380 --> 00:52:54.170
is always exactly the same as
the coefficient for the most
00:52:54.170 --> 00:52:58.130
positive frequency.
00:52:58.130 --> 00:53:01.100
And so they're
just given in one--
00:53:01.100 --> 00:53:03.950
they're both given in
one element of the array.
00:53:06.490 --> 00:53:10.610
You could replicate
that up here,
00:53:10.610 --> 00:53:12.050
but it would be pointless.
00:53:12.050 --> 00:53:14.780
And the length of the array
would have to be n plus 1.
00:53:19.730 --> 00:53:21.215
Yes?
00:53:21.215 --> 00:53:24.200
AUDIENCE: [INAUDIBLE]
00:53:24.200 --> 00:53:25.410
MICHALE FEE: OK.
00:53:25.410 --> 00:53:26.010
Good.
00:53:26.010 --> 00:53:29.670
That question always comes
up, and it's a great question.
00:53:32.530 --> 00:53:34.240
What we're trying
to do is to come up
00:53:34.240 --> 00:53:39.410
with a way of representing
arbitrary functions.
00:53:44.980 --> 00:53:49.530
So we can represent
symmetric functions
00:53:49.530 --> 00:53:53.220
by summing together
a bunch of cosines.
00:53:53.220 --> 00:53:55.890
We can represent
antisymmetric functions
00:53:55.890 --> 00:53:58.450
by summing together
a bunch of sines.
00:53:58.450 --> 00:54:01.290
But if we want to represent
an arbitrary function,
00:54:01.290 --> 00:54:03.630
we have to use both
cosines and sines.
00:54:10.080 --> 00:54:13.320
So we have this trick,
though, where we can,
00:54:13.320 --> 00:54:15.870
instead of using
sines and cosines,
00:54:15.870 --> 00:54:17.910
using these two
separate functions,
00:54:17.910 --> 00:54:22.620
we can use a single function
which is a complex exponential
00:54:22.620 --> 00:54:27.450
to represent things that can be
represented by sums of cosines
00:54:27.450 --> 00:54:31.080
as well as things that can be
represented as sums of signs.
00:54:31.080 --> 00:54:33.840
It's an arbitrary function.
00:54:33.840 --> 00:54:37.560
And the reason is because
the complex exponential has
00:54:37.560 --> 00:54:40.200
both a cosine in it and a sine.
00:54:45.590 --> 00:54:50.960
So we can represent a cosine
as a complex exponential
00:54:50.960 --> 00:54:53.180
with a positive
frequency, meaning
00:54:53.180 --> 00:54:56.300
that it's a complex
number that goes
00:54:56.300 --> 00:55:02.710
around this direction
plus another function
00:55:02.710 --> 00:55:06.440
where the complex number is
going around in this direction.
00:55:06.440 --> 00:55:12.800
So positive frequencies
mean as time increases,
00:55:12.800 --> 00:55:14.780
this complex number is
going around the unit
00:55:14.780 --> 00:55:16.100
circle in this direction.
00:55:16.100 --> 00:55:18.980
Negative frequencies
mean the complex number's
00:55:18.980 --> 00:55:20.340
going around in this direction.
00:55:20.340 --> 00:55:26.410
And you can see that in
order to represent a cosine,
00:55:26.410 --> 00:55:28.080
I need to have--
00:55:28.080 --> 00:55:29.680
so let's see if I can do this.
00:55:29.680 --> 00:55:33.670
Here's my e to the-- here's
my plus frequency going
00:55:33.670 --> 00:55:35.540
around this way.
00:55:35.540 --> 00:55:38.800
Here's my minus frequency
going around this way.
00:55:38.800 --> 00:55:40.510
And you can see
that I can represent
00:55:40.510 --> 00:55:47.530
a cosine if I can make the
imaginary parts cancel.
00:55:47.530 --> 00:55:50.620
So if I have one function
that's going around like this,
00:55:50.620 --> 00:55:52.750
another function that's
going around like this.
00:55:52.750 --> 00:56:00.240
If I add them, then the
imaginary part cancels.
00:56:00.240 --> 00:56:01.780
The sine cancels.
00:56:01.780 --> 00:56:05.410
This plus this is
cosine plus cosine.
00:56:05.410 --> 00:56:07.390
i sine minus i sine.
00:56:07.390 --> 00:56:10.190
So the sines can--
the sine cancels.
00:56:10.190 --> 00:56:11.830
And what I'm left
with is a sine.
00:56:11.830 --> 00:56:15.880
So represent a cosine as
a sum of a function that
00:56:15.880 --> 00:56:21.700
has a positive frequency
and a negative frequency.
00:56:21.700 --> 00:56:24.070
You can see that
the y component,
00:56:24.070 --> 00:56:26.200
the imaginary component,
cancels and all
00:56:26.200 --> 00:56:29.950
I'm left with is the cosine
that's going across like this.
00:56:29.950 --> 00:56:33.620
So it's just a
mathematical trick.
00:56:33.620 --> 00:56:35.270
Positive and
negative frequencies
00:56:35.270 --> 00:56:43.210
are just a mathematical trick to
make either the symmetric part
00:56:43.210 --> 00:56:47.260
of the function or antisymmetric
part of the function cancel.
00:56:47.260 --> 00:56:52.840
So I can just use these positive
and negative frequencies
00:56:52.840 --> 00:56:54.400
to represent any function.
00:56:54.400 --> 00:56:57.130
If I only had
positive frequencies,
00:56:57.130 --> 00:56:59.620
I wouldn't be able to
represent arbitrary functions.
00:57:03.720 --> 00:57:06.360
So just one more
little thing that you
00:57:06.360 --> 00:57:11.460
need to know about
the FFT algorithm.
00:57:11.460 --> 00:57:15.500
So remember we talked about if
you have a function of time,
00:57:15.500 --> 00:57:20.200
negative times are over here,
positive times are over here.
00:57:20.200 --> 00:57:23.230
You can put-- you can
sample your function
00:57:23.230 --> 00:57:26.110
at different times and put
those different samples
00:57:26.110 --> 00:57:27.430
into an array.
00:57:27.430 --> 00:57:30.880
Before you send this
array of time samples
00:57:30.880 --> 00:57:33.370
to the FFT algorithm,
you just need
00:57:33.370 --> 00:57:36.190
to swap the right
half of the array
00:57:36.190 --> 00:57:38.710
with the left half of the
array using a function called
00:57:38.710 --> 00:57:40.560
time shifted arrays.
00:57:43.370 --> 00:57:44.310
Don't worry about it.
00:57:44.310 --> 00:57:47.090
It's just the guts
of the FFT algorithm
00:57:47.090 --> 00:57:49.760
wants to have the positive
times in the first half
00:57:49.760 --> 00:57:52.850
and the negative times
in the second half.
00:57:52.850 --> 00:57:57.400
So you just do this.
00:57:57.400 --> 00:58:04.970
Then you run the FFT function
on this time shifted array.
00:58:04.970 --> 00:58:07.690
And what it spits
back is an array
00:58:07.690 --> 00:58:10.750
with the positive
frequencies in the first half
00:58:10.750 --> 00:58:13.690
and the negative frequencies
in the second half.
00:58:13.690 --> 00:58:19.120
And you can just swap those
back using the circshift again.
00:58:19.120 --> 00:58:23.770
That is your spectrum.
00:58:23.770 --> 00:58:25.420
Your spectral coefficients.
00:58:25.420 --> 00:58:28.150
Your Fourier coefficients
of this function.
00:58:31.980 --> 00:58:33.685
Just MATLAB guts.
00:58:33.685 --> 00:58:34.560
Don't worry about it.
00:58:39.120 --> 00:58:42.430
So here's a piece of code
that computes the Fourier
00:58:42.430 --> 00:58:45.460
coefficients of a function.
00:58:45.460 --> 00:58:47.410
So the first thing
we're going to do
00:58:47.410 --> 00:58:51.800
is define the number of points
that we have in our array.
00:58:51.800 --> 00:58:53.140
2048.
00:58:53.140 --> 00:58:54.980
So it's a power of 2.
00:58:54.980 --> 00:58:57.490
So the FFT algorithm runs fast.
00:58:57.490 --> 00:59:01.940
We're figuring out-- we're
going to write down a delta t.
00:59:01.940 --> 00:59:05.470
In this case, it's
one millisecond.
00:59:05.470 --> 00:59:10.760
The sampling rate, the
sampling frequency is just 1
00:59:10.760 --> 00:59:11.720
over delta t.
00:59:11.720 --> 00:59:14.750
So 1 kilohertz.
00:59:14.750 --> 00:59:19.730
The array of times at
which the function sampled
00:59:19.730 --> 00:59:22.480
is just going from
minus n over 2
00:59:22.480 --> 00:59:26.390
to plus n over 2
minus 1 times delta t.
00:59:29.870 --> 00:59:33.060
I'm defining the
frequency of a sine wave.
00:59:33.060 --> 00:59:37.260
And we're now getting the
values of that cosine function
00:59:37.260 --> 00:59:39.870
at those different times.
00:59:39.870 --> 00:59:42.160
Does that make sense?
00:59:42.160 --> 00:59:44.950
We're taking that
function of time
00:59:44.950 --> 00:59:48.910
and circularly shifting
it by half the array.
00:59:48.910 --> 00:59:55.210
So that's the circularly
shifted, the swapped values
00:59:55.210 --> 00:59:56.500
of our function y.
00:59:56.500 --> 00:59:58.315
We stick that into
the FFT function.
01:00:00.870 --> 01:00:03.570
It gives you back the
Fourier coefficients.
01:00:03.570 --> 01:00:05.640
You just swap it again.
01:00:08.510 --> 01:00:12.290
And that is the spectrum, the
Fourier transform [INAUDIBLE]
01:00:12.290 --> 01:00:12.790
signal.
01:00:15.460 --> 01:00:17.250
And now you can
write down a vector
01:00:17.250 --> 01:00:22.463
of frequencies of each one of
those Fourier coefficients.
01:00:30.360 --> 01:00:34.770
Each one of those segments
in that vector y--
01:00:34.770 --> 01:00:38.850
remember, there are 2,000
of them now, 2,048 of them--
01:00:38.850 --> 01:00:42.400
each one of those is
the Fourier coefficient
01:00:42.400 --> 01:00:46.150
of the function we
put in at each one
01:00:46.150 --> 01:00:47.560
of those different frequencies.
01:00:52.120 --> 01:00:54.700
Does that make sense?
01:00:54.700 --> 01:00:56.800
Now let's take a look
at a few examples
01:00:56.800 --> 01:00:59.570
of what that looks like.
01:00:59.570 --> 01:01:03.000
So here is a function y of t.
01:01:03.000 --> 01:01:09.230
It's cosine 2 pi f 0 t
where f 0 is 20 hertz.
01:01:09.230 --> 01:01:13.040
So it's just a cosine wave.
01:01:13.040 --> 01:01:18.010
You run this code on it.
01:01:18.010 --> 01:01:23.280
And what you get back is an
array of complex numbers.
01:01:23.280 --> 01:01:31.430
It has a real and imaginary
part as a function of frequency.
01:01:31.430 --> 01:01:34.745
And you get this
cosine function.
01:01:34.745 --> 01:01:38.870
It has two peaks, as promised.
01:01:38.870 --> 01:01:44.090
It has a peak at plus 20 hertz
and a peak at minus 20 hertz.
01:01:46.630 --> 01:01:51.240
One of those peaks
gives you an e
01:01:51.240 --> 01:01:54.790
to the i omega t that
goes this way at 20 hertz.
01:01:54.790 --> 01:01:57.370
The other one gives you
an e of the i omega t
01:01:57.370 --> 01:01:59.650
that goes this way at 20 hertz.
01:01:59.650 --> 01:02:04.700
And when you add them
together, if I can do that,
01:02:04.700 --> 01:02:06.430
it gives you a cosine.
01:02:06.430 --> 01:02:08.973
It goes back and
forth at 20 hertz.
01:02:08.973 --> 01:02:09.959
That one.
01:02:18.840 --> 01:02:20.100
Here's a sine wave.
01:02:20.100 --> 01:02:24.770
y equals sine 2 pi f
0 t again at 20 hertz.
01:02:24.770 --> 01:02:26.720
You run that code on it.
01:02:26.720 --> 01:02:29.390
It gives you this.
01:02:29.390 --> 01:02:30.980
Notice that-- OK, sorry.
01:02:30.980 --> 01:02:32.600
Let me just point
out one more thing.
01:02:32.600 --> 01:02:37.400
In this case, the peaks
are in the real part of y.
01:02:37.400 --> 01:02:41.630
For the sine function,
the real part is 0
01:02:41.630 --> 01:02:43.310
and the peaks are in
the imaginary part.
01:02:43.310 --> 01:02:48.470
There's a plus i at
minus 20 i over 2,
01:02:48.470 --> 01:02:56.230
actually, at minus 20 hertz,
a minus i at plus 20 hertz.
01:02:56.230 --> 01:03:00.700
And what that does is when you
multiply that coefficient times
01:03:00.700 --> 01:03:06.050
e to the i omega t and that
coefficient times whichever
01:03:06.050 --> 01:03:07.550
the opposite one is.
01:03:07.550 --> 01:03:10.560
One going this way, the
other one going this way.
01:03:10.560 --> 01:03:13.580
You can see that the
real part now cancels.
01:03:13.580 --> 01:03:18.755
And what you're left with is the
sine part that doesn't cancel.
01:03:21.460 --> 01:03:24.830
And that is this
function sine omega t.
01:03:31.508 --> 01:03:35.160
Any questions about that?
01:03:35.160 --> 01:03:36.342
That's kind of boring.
01:03:36.342 --> 01:03:38.550
We're going to put more
interesting functions in here
01:03:38.550 --> 01:03:39.610
soon.
01:03:39.610 --> 01:03:43.110
But I just wanted you to
see what this algorithm does
01:03:43.110 --> 01:03:47.722
on the things that we've
been talking about all along.
01:03:47.722 --> 01:03:49.430
And it gives you
exactly what you expect.
01:03:52.330 --> 01:03:57.850
Remember, we can write
down any arbitrary function
01:03:57.850 --> 01:04:02.450
as a sum of sines and cosines.
01:04:04.970 --> 01:04:09.660
Which means we can write
down any arbitrary function
01:04:09.660 --> 01:04:21.870
as a sum of these little
peaks and these peaks
01:04:21.870 --> 01:04:25.580
at different frequencies.
01:04:25.580 --> 01:04:26.840
Does that make sense?
01:04:26.840 --> 01:04:32.320
So all we have to do is
find these coefficients,
01:04:32.320 --> 01:04:34.960
these peaks, what values
of these different peaks
01:04:34.960 --> 01:04:39.890
to stick in to reconstruct
any arbitrary function.
01:04:39.890 --> 01:04:43.800
And we're going to do a lot
of that in the next lecture.
01:04:43.800 --> 01:04:47.210
We're going to look at what
different functions here look
01:04:47.210 --> 01:04:50.570
like in the Fourier domain.
01:04:50.570 --> 01:04:54.140
We're going to do that for some
segments like a square pulse,
01:04:54.140 --> 01:05:00.660
for trains of
pulses, for Gaussian,
01:05:00.660 --> 01:05:02.250
for all kinds of
different functions.
01:05:02.250 --> 01:05:04.380
And then using the
convolution theorem,
01:05:04.380 --> 01:05:06.990
you can actually just
predict in your own mind
01:05:06.990 --> 01:05:11.610
what different combinations of
those functions will look like.
01:05:11.610 --> 01:05:14.760
So I want to end by talking
about one other really
01:05:14.760 --> 01:05:18.495
critical concept called
the power spectrum.
01:05:18.495 --> 01:05:22.020
And it's basically
usually what you
01:05:22.020 --> 01:05:28.470
do when you compute the
Fourier transform of a function
01:05:28.470 --> 01:05:32.790
is to figure out what
the power spectrum is.
01:05:32.790 --> 01:05:34.890
The simple answer
is that all you do
01:05:34.890 --> 01:05:37.140
is you square this thing.
01:05:37.140 --> 01:05:39.510
Take the magnitude squared.
01:05:39.510 --> 01:05:41.670
But I'm going to build
up to that a little bit.
01:05:44.250 --> 01:05:45.720
So it's called the
power spectrum.
01:05:45.720 --> 01:05:50.333
But first we need to understand
what we mean by power.
01:05:50.333 --> 01:05:51.750
So we're going to
think about this
01:05:51.750 --> 01:05:55.050
in the context of a
simple electrical circuit.
01:05:55.050 --> 01:05:57.930
Let's imagine that this
function that we're
01:05:57.930 --> 01:06:00.810
computing the Fourier
transform of, imagine
01:06:00.810 --> 01:06:02.970
this function is voltage.
01:06:02.970 --> 01:06:05.130
That's where this
idea comes from.
01:06:05.130 --> 01:06:07.350
Imagine that this
function is the voltage
01:06:07.350 --> 01:06:09.540
that you've measured
somewhere in a circuit.
01:06:09.540 --> 01:06:11.280
Let's say in this
circuit right here.
01:06:11.280 --> 01:06:14.570
Or current, either way.
01:06:14.570 --> 01:06:19.670
So when you have current
flowing through this circuit,
01:06:19.670 --> 01:06:23.060
you can see that sinusoid--
that some oscillatory
01:06:23.060 --> 01:06:25.670
current, some
cosine, that drives
01:06:25.670 --> 01:06:27.830
current through this resistor.
01:06:27.830 --> 01:06:33.470
And when current flows to a
resistor, it dissipates power.
01:06:33.470 --> 01:06:35.690
And the power
dissipated in a resistor
01:06:35.690 --> 01:06:39.110
is just the current
times the voltage drop
01:06:39.110 --> 01:06:42.040
across that resistor.
01:06:42.040 --> 01:06:43.780
That means that the power--
01:06:43.780 --> 01:06:45.430
now, remember,
Ohm's law tells you
01:06:45.430 --> 01:06:49.090
that current is just voltage
divided by resistance.
01:06:49.090 --> 01:06:50.920
So this is v divided by r.
01:06:50.920 --> 01:06:57.090
So the power is just v
squared divided by r.
01:06:57.090 --> 01:07:02.100
So if the voltage is just a
sine wave at frequency omega,
01:07:02.100 --> 01:07:08.890
then v is some coefficient,
some amplitude at that
01:07:08.890 --> 01:07:11.490
frequency times cosine omega t.
01:07:11.490 --> 01:07:18.820
We can write that voltage
using Euler's equation as 1/2 e
01:07:18.820 --> 01:07:22.570
to the minus i omega t plus
1/2 e to the plus i omega t.
01:07:26.110 --> 01:07:29.940
And let's calculate the power
associated with that voltage.
01:07:29.940 --> 01:07:37.270
Well, we have to average over
one cycle of that oscillation.
01:07:37.270 --> 01:07:39.780
So the average
power is just given
01:07:39.780 --> 01:07:43.810
by the square magnitude of the
Fourier transform [INAUDIBLE]..
01:07:43.810 --> 01:07:46.260
So let's just plug
this into here.
01:07:46.260 --> 01:07:50.130
And what you see is that the
power at a given frequency
01:07:50.130 --> 01:07:54.690
omega is just that coefficient
magnitude squared over
01:07:54.690 --> 01:08:03.280
resistance times 1/2 e to
the minus i omega t magnitude
01:08:03.280 --> 01:08:06.370
squared plus 1/2 e
to the plus i over i
01:08:06.370 --> 01:08:09.320
omega t magnitude squared.
01:08:09.320 --> 01:08:14.220
And that's just
equal to 1 over r.
01:08:14.220 --> 01:08:18.979
That coefficient
magnitude squared over 2.
01:08:18.979 --> 01:08:22.960
So you can see that
the power dissipated
01:08:22.960 --> 01:08:29.950
by this sinusoidal
voltage is just
01:08:29.950 --> 01:08:32.590
that magnitude squared over 2.
01:08:36.790 --> 01:08:41.500
So we can calculate the power
dissipated in any resistor
01:08:41.500 --> 01:08:44.109
simply by summing up the
[INAUDIBLE] magnitude
01:08:44.109 --> 01:08:46.979
of those coefficients.
01:08:46.979 --> 01:08:50.930
So let's look at that
in a little more detail.
01:08:50.930 --> 01:08:55.069
So let's think for a moment
about the energy that
01:08:55.069 --> 01:09:00.580
is dissipated by a signal.
01:09:00.580 --> 01:09:03.939
So energy is just the
integral over time.
01:09:03.939 --> 01:09:05.740
Power is per unit time.
01:09:05.740 --> 01:09:07.630
Total energy is
just the integral
01:09:07.630 --> 01:09:10.300
of the power over time.
01:09:10.300 --> 01:09:14.500
So power is just equal
to v squared over r.
01:09:14.500 --> 01:09:16.439
So I'm just going to
substitute that in there.
01:09:16.439 --> 01:09:18.729
So the energy of
a signal is just 1
01:09:18.729 --> 01:09:23.200
over r times the integral
of v squared over time.
01:09:28.850 --> 01:09:32.140
Now, there's an
important theorem
01:09:32.140 --> 01:09:34.720
in complex analysis
called Parseval's theorem
01:09:34.720 --> 01:09:41.560
that says that the integral over
the square of the coefficients
01:09:41.560 --> 01:09:46.550
in time is just
equal to the integral
01:09:46.550 --> 01:09:49.990
of the square magnitude
coefficients in frequency.
01:09:54.310 --> 01:09:56.650
So what that's
saying is that it's
01:09:56.650 --> 01:09:59.500
just the same as the
total power in the signal
01:09:59.500 --> 01:10:03.520
or the total energy in a signal
if you represent it in the time
01:10:03.520 --> 01:10:08.190
domain is just the same as
the total energy in the signal
01:10:08.190 --> 01:10:11.590
if you look at it in
the frequency domain.
01:10:11.590 --> 01:10:15.400
And what that's saying is
that the sum of all the
01:10:15.400 --> 01:10:21.650
squared temporal
components is just
01:10:21.650 --> 01:10:27.710
this equal to the sum of all the
squared frequency components.
01:10:27.710 --> 01:10:31.040
And what that means
is that you can
01:10:31.040 --> 01:10:35.210
see that each of these frequency
components, each component
01:10:35.210 --> 01:10:37.700
in frequency contributes
independently
01:10:37.700 --> 01:10:40.940
to the power in the signal.
01:10:40.940 --> 01:10:44.210
What that means is
that you can think--
01:10:44.210 --> 01:10:46.940
so you can think
of the total energy
01:10:46.940 --> 01:10:50.870
in the signal as just the
integral over all frequencies
01:10:50.870 --> 01:10:53.900
of this quantity here that
we call the power spectrum.
01:10:58.400 --> 01:11:00.230
And so we'll often
take a signal,
01:11:00.230 --> 01:11:02.240
calculate the
Fourier components,
01:11:02.240 --> 01:11:06.070
and plot the area of
the Fourier transform,
01:11:06.070 --> 01:11:08.888
the square magnitude of
the Fourier transform.
01:11:08.888 --> 01:11:10.430
And that's called
the power spectrum.
01:11:13.550 --> 01:11:17.470
And I've already said the total
variance of the signal in time
01:11:17.470 --> 01:11:19.940
is the same as the total
variance of the signal
01:11:19.940 --> 01:11:22.020
in the frequency domain.
01:11:22.020 --> 01:11:26.170
So mathy people talk about
the variant of a signal.
01:11:26.170 --> 01:11:29.120
The more engineering people talk
about the power in the signal.
01:11:29.120 --> 01:11:31.120
But they're really talking
about the same thing.
01:11:36.830 --> 01:11:39.063
So let's take this example
that we just looked at
01:11:39.063 --> 01:11:40.355
and look at the power spectrum.
01:11:43.830 --> 01:11:46.150
So that's a cosine function.
01:11:46.150 --> 01:11:47.175
It has these two peaks.
01:11:52.860 --> 01:11:56.310
Let me just point out
one more important thing.
01:11:56.310 --> 01:11:59.950
For real functions,
so in this class,
01:11:59.950 --> 01:12:03.300
we're only going to be talking
about real functions of time.
01:12:03.300 --> 01:12:07.260
For real functions, the square
magnitude of the Fourier
01:12:07.260 --> 01:12:11.840
transform is symmetric.
01:12:11.840 --> 01:12:15.090
So you can see here
if there is a peak
01:12:15.090 --> 01:12:17.450
in the positive
frequencies, there's
01:12:17.450 --> 01:12:21.180
an equivalent peak in
the negative frequencies.
01:12:21.180 --> 01:12:25.540
So when we plot the power
spectrum of a signal,
01:12:25.540 --> 01:12:29.680
we always just plot
the positive side.
01:12:29.680 --> 01:12:31.370
And so here's what
that looks like.
01:12:31.370 --> 01:12:36.810
Here is the power spectrum
of a cosine signal.
01:12:36.810 --> 01:12:39.510
And it's just a single peak.
01:12:39.510 --> 01:12:42.740
So in that case, it was
a cosine at 20 hertz.
01:12:42.740 --> 01:12:45.861
You get a single
peak at 20 hertz.
01:12:49.750 --> 01:12:54.300
What does it look like
for a sine function?
01:12:54.300 --> 01:12:56.330
What is the power spectrum
of a sine function?
01:12:56.330 --> 01:12:59.720
Remember, in that case,
it was the real part was 0
01:12:59.720 --> 01:13:02.180
and the imaginary part
had a plus peak here
01:13:02.180 --> 01:13:03.650
and a minus peak here.
01:13:03.650 --> 01:13:05.990
What does the spectrum
of that look like?
01:13:08.670 --> 01:13:09.220
Right.
01:13:09.220 --> 01:13:15.250
The square magnitude
of i is just 1.
01:13:15.250 --> 01:13:17.890
Magnitude squared
of i is just 1.
01:13:21.550 --> 01:13:24.870
So the power spectrum
of a sine function
01:13:24.870 --> 01:13:27.520
looks exactly like this.
01:13:27.520 --> 01:13:29.200
Same as a cosine.
01:13:29.200 --> 01:13:30.130
Makes a lot of sense.
01:13:30.130 --> 01:13:32.650
Sine and cosine are
exactly the same function.
01:13:32.650 --> 01:13:38.280
One's just shifted
by a quarter period.
01:13:41.020 --> 01:13:43.270
So it has to have the
same power spectrum.
01:13:43.270 --> 01:13:46.560
It has to have the same power.
01:13:46.560 --> 01:13:49.080
Let's take a look at a
different function of time.
01:13:49.080 --> 01:13:50.670
Here's a train of
delta functions.
01:13:50.670 --> 01:13:54.660
So we just have a bunch
of peaks spaced regularly
01:13:54.660 --> 01:13:55.710
at some period.
01:13:55.710 --> 01:13:56.400
I think it was--
01:13:56.400 --> 01:13:58.140
I forget the exact number here.
01:13:58.140 --> 01:14:01.620
But it's around 10-ish hertz.
01:14:04.820 --> 01:14:08.080
Fourier transform of a
train of delta functions
01:14:08.080 --> 01:14:11.550
is another train
of delta functions.
01:14:11.550 --> 01:14:14.260
Pretty cool.
01:14:14.260 --> 01:14:18.530
The period in the time
domain is delta t.
01:14:18.530 --> 01:14:23.330
The period in the Fourier
domain is 1 over delta t.
01:14:23.330 --> 01:14:27.250
That's another really important
Fourier transform pair for you
01:14:27.250 --> 01:14:27.750
to know.
01:14:27.750 --> 01:14:30.830
So the first Fourier transform
pair that you need to know
01:14:30.830 --> 01:14:35.040
is that a constant in the time
domain is a delta function
01:14:35.040 --> 01:14:36.330
in the frequency domain.
01:14:36.330 --> 01:14:38.900
A delta function
in the time domain
01:14:38.900 --> 01:14:42.670
is a constant in the
frequency domain.
01:14:42.670 --> 01:14:45.530
A train of delta functions
in the time domain
01:14:45.530 --> 01:14:48.890
is a train of functions in
the frequency domain and vice
01:14:48.890 --> 01:14:50.720
versa.
01:14:50.720 --> 01:14:52.190
And there's a very
simple relation
01:14:52.190 --> 01:14:54.270
between the period
in the time domain
01:14:54.270 --> 01:14:56.480
and the period in
the frequency domain.
01:14:56.480 --> 01:15:01.020
What does the power spectrum of
this train of delta functions
01:15:01.020 --> 01:15:01.520
look like?
01:15:09.160 --> 01:15:12.435
It's just the square
magnitude of this.
01:15:12.435 --> 01:15:14.060
So it just looks like
a bunch of peaks.
01:15:17.620 --> 01:15:20.230
So here's another function.
01:15:20.230 --> 01:15:21.610
A square wave.
01:15:21.610 --> 01:15:27.110
This is exactly the same
function that we started with.
01:15:27.110 --> 01:15:28.700
If you look at the
Fourier transform
01:15:28.700 --> 01:15:35.810
of the imaginary part of 0,
the real part has these peaks.
01:15:35.810 --> 01:15:40.180
So the Fourier transform-- so
these are now the coefficients
01:15:40.180 --> 01:15:43.900
that you would put in front
of your different cosines
01:15:43.900 --> 01:15:49.100
at different frequencies to
represent the square wave.
01:15:49.100 --> 01:15:53.420
But what it looks like is
positive peak for the lowest
01:15:53.420 --> 01:16:01.030
frequency, negative peak for the
next harmonic, positive peak,
01:16:01.030 --> 01:16:04.750
and gradually
decreasing amplitudes.
01:16:04.750 --> 01:16:07.490
The power spectrum of this--
01:16:07.490 --> 01:16:12.650
oh, and one more point is that
if you look at the Fourier
01:16:12.650 --> 01:16:17.570
transform of a higher
frequency square wave,
01:16:17.570 --> 01:16:22.150
you can see that those
peaks move apart.
01:16:22.150 --> 01:16:24.060
So you can transform.
01:16:24.060 --> 01:16:27.840
So higher frequencies in the
time domain, stuff happening
01:16:27.840 --> 01:16:32.730
faster in the time
domain, is associated
01:16:32.730 --> 01:16:37.540
with things moving out to higher
frequencies in the frequency
01:16:37.540 --> 01:16:38.750
domain.
01:16:38.750 --> 01:16:42.190
You can see that the same
function higher frequencies
01:16:42.190 --> 01:16:46.420
has the same Fourier transform
but with the components spread
01:16:46.420 --> 01:16:48.940
out to higher frequencies.
01:16:48.940 --> 01:16:51.920
And the power spectrum
looks like this.
01:16:51.920 --> 01:16:56.500
And notice that one
more final point here
01:16:56.500 --> 01:17:00.190
is that when you look at
power spectra, often signals
01:17:00.190 --> 01:17:05.050
can have frequency
components that
01:17:05.050 --> 01:17:09.740
are very small so that it's hard
to see them on a linear scale.
01:17:09.740 --> 01:17:12.850
And so we actually plot
them in this method.
01:17:12.850 --> 01:17:15.040
You plot them in
units of decibels.
01:17:15.040 --> 01:17:17.370
And I'll explain what
those are the next time.
01:17:17.370 --> 01:17:20.200
But that's another
representation of the power
01:17:20.200 --> 01:17:23.200
spectrum of a signal.
01:17:23.200 --> 01:17:25.550
OK, so that's what
we've covered.
01:17:25.550 --> 01:17:29.940
And we're going to continue
with the game plan next time.