-
Alright. So, one other problem associated
with this, which is you might say,
-
something like, well, okay, this is all
fine and good. In fact, if it's really
-
noise, then even if I go to the time
domain, I could just take my time domain
-
and just kinda like average my time domain
and I should get the little bump out that
-
I'm expecting in the time domain. Okay. So
I'm gonna show you one example where that
-
actually does not work. Cuz what happens
if it's moving in a time domain? That's
-
what we wanna address. Okay? Everybody
good with that? Kinda cool? Simple
-
filtering, simple making use of the fact
that you know something about noise.
-
Alright. So, let's do something a little
more complicated and let's come back up
-
actually to the board real quick here and
to motivate it, cuz I, I just you know,
-
it's hard to get motivated. That's helping
out. Alright. If I could get a [INAUDIBLE]
-
Oh, there's my eraser. Alright. So here is
the deal. If you really do have this
-
airplane flying around up here, it's
moving, and in some sense, you kinda go
-
like you know, presumably it's moving
pretty fast. Okay? So in 30 seconds, this
-
thing can go a pretty long ways if you've
got a plane going you know, close to Mach
-
one or Mach two or Mach three.
Okay? Normally, we think of that going
-
super fast and you're saying, well, I have
a signal now that as I keep taking
-
information out of this, the information
actually is translating along. Okay? So,
-
if you are thinking about saying, well, I
could just send a time domain, take the
-
signal, and just average it. Well, the
signal's here and now it's moving that way
-
like my, Mach two.
Okay? So you can't just average this out,
-
because this will just average out to zero
as well. The signal is gone. If you look
-
in the time domain, you average a moving
signal, it's gone. However, the frequency
-
signature doesn't change. So if I bounce
stuff off of here, it would still come
-
back, as, let's say we're making up, that
doesn't change, so my frequency signature
-
doesn't change. Now, if you are really
clever engineer and you could actually
-
find a way to make your plane shift its
frequency and start getting frequent,
-
signatures, frequency signature all over
the place, the filter wouldn't be able to
-
pick it up very well. Right? Cuz you'd
shift it you know, oh, wait, wait a
-
minute, I was, I was filtering over here
but now you've moved your you know, if you
-
can, if you can do something like that.
Okay? Through frequency conversion then
-
you could screw up a detector, but what
we're gonna do is very simple, which is if
-
you do this, no is coming back. This thing
is moving and if you try to average in the
-
time domain, you get zero. You get nothing
out of it. However, you average in the
-
frequency domain, you can recover
everything. Okay? Again, like your dog
-
problem. Nathaniel, how's it going back
there? Do you go by Nate? Nathaniel?
-
Nathan? Nate, all right. Okay, so there's
no confusion, because I go by Nate Dogg,
-
cuz it's my rapper name. So as long as you
stay away from that one, we're all good.
-
Okay. So the dog problem Nate, right, is
there's this moving marble in the
-
intestine of your dog that you gotta blow
up. So you gotta know where it is
-
accurately or else it'll blow up other
parts of the dog. By the way, it's kind of
-
interesting. anybody in biomedical
engineer in here? Right. So is there
-
somebody in my class that had this, couple
years back that they were looking at, like
-
trying to you know, shoot kidney stones.
And, I was amazed when they're talking on
-
the side in a thesis, how many times they
miss? Like, they shoot these big things to
-
crush the kidney stone, but you know,
people move, fluid stuff moves, and then
-
it just misses. Well, that does damage to
other parts of your body. Anyway, just
-
want to let you know that. So sit really
still if you gotta get a shoot kidney
-
stone shot. Okay? And so that's what
you're doing with your dog. The particle
-
itself is moving and the signature is
constant in frequency. So you gotta have
-
to figure out where that frequency sits
and go after that. Okay? Alright. So
-
that's also here, it's moving, that's
okay. If this is moving super fast, all
-
you got to key on is the frequency
signature because that plane can't shift
-
the, can't shift the frequency that you're
sending out. Yeah. Would effects due to
-
the Doppler Effect ever be important in a
problem like this or? Yeah, in fact you
-
know, what I'm talking about is such basic
radar stuff, right? But, actually, you can
-
do all kinds of data processing making use
of that. Yeah, in fact, you would, you
-
would definitely make use of that. That
would give you sort of, for instance, how
-
fast is that thing moving, much more
accurately and quickly. It's giving you
-
some kind of information. Okay. So let's,
let's program up, then a signal and I'll
-
show you sort of what it might look like
in time and frequency before you
-
pre-process. And, you get to learn a
little bit of fancy MATLAB. Okay. So,
-
let's come back to here and what I wanna
do is, I wanna plot a signal that's moving
-
in time and then I wanna plot what its
frequency spectrum looks like as well.
-
Okay. So let's come back up to here and
I'm gonna kill it from there. Okay. So we
-
still have all our stuff here. We have our
k, our t, and now what I'm gonna do in
-
fact, I think I made this a little bit
bigger. I'm gonna do this to be 60. So,
-
here's what I'm gonna do. I'm gonna define
a thing called slice. It's a vector, goes
-
from zero, steps from 0.5 to ten. This is
gonna be like my time slices times zero, I
-
take a reading. A time and a half, I take
a reading. could be so for instance that I
-
take or, or half a minute, I take a
reading. Whatever this happens to be in
-
units and I just keep taking readings, at
every 0.5 all the way to ten. So I have a
-
total of 21 readings I'm gonna take the
data, 'kay, which isn't a whole lot, but
-
fine just for example. And what I wanna do
is define some new variables, call them T
-
and S, which is gonna be what's called a
meshgrid(t,slice).
-
Yes? You have already, already defined
capital C on line three. Is that gonna
-
conflict it all with. Oh, I just overwrote
it. That's okay. Yeah, but. Tha t's okay.
-
Yeah, I mean, if I wanted to use this
again at some point, this is the kind of
-
programming mistake that's so rookie, I
would never make it. I just did it in
-
class to show you what kind of mistakes
you can make. Yeah, rookie move. We'll
-
stay with it though, just to show that no
matter how far in life you go. you know, I
-
have a couple of mantras about teaching
and you've heard them I think, in my class
-
before it knows, there's two things you
never do, ever. I mean this is the best
-
advice I have to give ever in my whole
life. first you don't do, you don't spell
-
in public and you don't do algebra in
public, cuz you will eventually do
-
something so stupid, like wow, like I
can't spell dog or can't add two to ten to
-
get cuz you're up there you know, and
you're nervous and everybody sees it, so
-
just don't do if you don't have to. I
would love to say don't program in public.
-
But unfortunately for this class, I cannot
get around that one. Alright. So there you
-
go. now what does the meshgrid do by the
way? What I'm thinking about right now, is
-
I'm taking time slices of data, so what t
is, right? Little t, here. T is, goes from
-
you know, -30 to 30 and I have a signal on
that. So, I have this domain where, okay,
-
so I have, for every, every little burst
of time, I take examples of length 60.
-
Okay? And I divide that 60 by 512, and
then, 0.5 units later is a different
-
units. I take another sample, another
measurement, again, with 512 points in it
-
and another in 512 points. Okay? So I'm
gonna collect this and what meshgrid does,
-
it gives us a sense of direction. It makes
a two-dimensional grid where in
-
one-dimension, it's time, in the other
dimension, it's this slice variable. Okay?
-
So t and slice now become capital T and
capital S, which are now matrices
-
conveying information about you know, ones
in one direction. One is in an orthogonal
-
direction to it. Okay? I wanna use those
to define our signal and we also need this
-
in the frequency domain, K, S. We're gonna
do the same thing here with the frequency
-
components .
In one direction, it's the wave numbers,
-
but then, it's wave number per sample in,
in the other direction, it's number
-
samples. Okay? Now, let's define a
function. Here it is, u=sech Now, I use
-
these variables cuz now they know about
their direction and I'll just show you
-
what I've got here, and so you can, it's a
simple function. I'm gonna, I'm gonna
-
leave this zero for right now. I'm gonna
tell you why in a moment cuz I wanna shift
-
the center frequency around. This is a
center frequency. If I leave it at zero,
-
it means that in the frequency domain I'm
centered at k equals zero, but we can make
-
this anything we want. I can make it
centered at k equals whatever else. I
-
want, in fact, in your dog problem, I'm
telling you right now if you put a filter
-
around k equals zero, your dog will die.
Tim, don't let your dog die. Okay.
-
Alright? So, alright, so don't put a
filter near zero, cuz it won't save
-
anybody. Alright. So that's gonna be my
function and so what I'm gonna do is
-
subplot this. I'm gonna say, okay, I'm
gonna use what's called the waterfall
-
command. And I like waterfall, because
it's a black and white picture, and it's
-
nicer to plot in color, however, I want to
set a view angle on it. The problem with
-
plotting in color is if you go to a
journal, it costs you a lot of money.
-
Okay. So there is like my plane moving
around, whatever you want to call it. This
-
thing is moving in time, right? So I have
this signal that's moving around and I
-
made a very simple movement. I made it
move like a sign wave in the slice
-
direction. So, it's just doing this. Okay?
All right. Now if I add noise to this and
-
I. No it's time domain, here. We're going
to look at the frequency in a moment. So,
-
if I add noise to this you know, we could
bury this whole thing, we could hide it.
-
And he said, well, yeah but I could just
average it to zero. If you average that,
-
this stuff all gets washed out. You get no
signal out. You have to do it in a
-
frequency domain. Okay? Alright. So, let's
take a look at the frequency domain of
-
this thing. So I have the signal moving
around in time, but if I just take this
-
Fourier transform then I can plot this
thing there. So, okay, so let's go ahead
-
over here. That's the first plot, and, so
I gotta do is that gonna go through this
-
and one slice at a time for every slice
take Fourier transform. Okay? So I say,
-
okay, fine. So what I'll do is I'll go
over here and I'm gonna say I will go grab
-
the first, first, let's say row of this u.
I'm going to ftt it. I just Fourier
-
transformed that first row and what I'm
going to do with this Fourier transform is
-
I'm going to plot it. So let's call this
UT j, okay? And, once I go through all of
-
this. Oh, come on. And actually, I don't
care about fft j or I, what I want to do
-
is maybe plot also, if fftshift it right
now. Okay? Cuz I just want to plot what
-
this looks like. There is my thing there.
And, might as well take the absolute value
-
while we're at it, for a moment, we're
gonna just this thing, absolute value. So
-
what I did here is I went to each row,
Fourier transformed it, then I have to
-
fft(shift) it with, with the absolute
value. And then what we can do is say,
-
okay, how about we look in subplot(2) and
I'm gonna do the waterfall again. But now,
-
I need the fftshift. Actually, did I do
this yeah, of, of K versus S versus UT.
-
Okay? So that's gonna be this Fourier
Transform. Oh, I should set the same view
-
angle, by the way. Sorry. Okay. So here's,
here is, here is perfect signal, which
-
doesn't exist in reality, right? Which is
I have this thing moving around and it's
-
moving in time. Tell me what it's doing in
frequency domain. Nothing. Awesome, right?
-
Because it's very important you know
what's happening in time and the whole
-
section at the beginning is kind of
understanding this idea between time
-
frequency dynamics. The time domain can be
doing all kinds of stuff, only that
-
frequency fixed. Okay? Remember, when we
do the noise reduction, your key thing is
-
to say, well, if I, if this thing is fixed
in frequency, all I got to do is build a
-
little filter out there in freque ncy,
capture that out. Okay? Cuz this thing is
-
not moving around. So I can be moving all
over the place, flying around my jet,
-
you're still giving off a fixed frequency
and this is what you'd lock in on, if
-
you're gonna do a detection.