Return to Video

W01_L03_P02 - Convergence to signal through repeated sampling

  • 0:00 - 0:05
    There. So now what I'm going to show you
    is this. I'm going to sample this over and
  • 0:05 - 0:10
    over again. Okay so in other words suppose
    I have my detector send out a read a
  • 0:10 - 0:16
    signal. I read a signal this. I keep
    reading 30 second slices of time. Okay and
  • 0:16 - 0:21
    presumably I keep getting different noise
    every time, right, cause white noise. So
  • 0:21 - 0:26
    what I'm going to do is ask what happens
    to these if I go through and I start
  • 0:26 - 0:35
    sampling over and over again. Okay. I can
    do anything I want. I am master of my
  • 0:35 - 0:41
    code. I can make noise a million. And by
    the way, that might just be one
  • 0:41 - 0:48
    realization. I run it again. Okay, so
    there's a little bit of a spike there,
  • 0:48 - 0:55
    fine, we'll go 30. I want to try to clean
    that up. As far as you can see in that
  • 0:55 - 1:00
    blue there is no evidence of anything
    right remember you got to launch a missile
  • 1:00 - 1:06
    or do something cool like that or save
    your dog. So you got to figure this out,
  • 1:06 - 1:11
    don't want any dead dogs in this class,
    cuz I'll be held accountable, probably.
  • 1:11 - 1:17
    Alright, here's what we're going to do,
    we're going to do a little loop, for J
  • 1:17 - 1:25
    equals 1-30. So what I going to do in this
    loop is the following. I'm going to take
  • 1:25 - 1:37
    my. Deal here. Let's, let's actually this
    just needs to be defined once so let's
  • 1:37 - 1:44
    bring this outside Lou so I have some
    noise which is 30. Yeah let me take away
  • 1:44 - 1:52
    these sub-plotting routines for a moment.
    Okay. Here's what I want to do. In this
  • 1:52 - 1:58
    loop we've gone this loop 30 times and
    each time we do it I'm going to generate a
  • 1:58 - 2:03
    new signal. Sorry I have the same signal,
    but I'm going to generate a new signal
  • 2:03 - 2:08
    because I'm going to add noise to it. So
    it's the same signal that I keep reading,
  • 2:08 - 2:12
    right? So in a radar problem if there's a
    plane out there, I keep picking up that
  • 2:12 - 2:16
    signal from the plane but it's buried, but
    it's buried inside noise which keeps
  • 2:16 - 2:22
    changing in time. Okay so every time I do
    this I have this issue of t that stays the
  • 2:22 - 2:27
    same but now the noise changes every time.
    So every time I do this I get different
  • 2:27 - 2:31
    noise on it, different noise on it. So
    each one of'em just looks like just what
  • 2:31 - 2:36
    we had before nothing there. So what I'm
    going to do is I'm going to just keep
  • 2:36 - 2:41
    doing this. And I'm going to ask if I do
    this and I go through this loop I want to
  • 2:41 - 2:45
    actually just calculate the average of
    what my spectrum looks like. I'm going to
  • 2:46 - 2:50
    add if I take 30 measurements. I'm going
    to add them together and divide by 30.
  • 2:50 - 2:56
    What happens to the noise? What I know is,
    is white noise, when it's uncorrelated.
  • 2:56 - 3:01
    All that noise should have mean. Sweet.
    Everything just going to just fair
  • 3:01 - 3:10
    anybody. One. Tough crowd. Tough crowd.
    Alright. I'm going to show ya a magic
  • 3:10 - 3:16
    trick, right? Okay, all right laptops
    usually don't come out of your sleeves
  • 3:16 - 3:22
    [LAUGH] iPhones can. but. Okay. One
    believer in the class. Let's see how many
  • 3:22 - 3:30
    of the others I can make believe in this.
    Alright, so here we go. . What's that?
  • 3:31 - 3:36
    Inverse. Inverse voice transform. So let's
    go through this and say, okay, here's what
  • 3:36 - 3:41
    I'm going to do. I've got to keep track of
    all this, right? So what I'm going to do
  • 3:41 - 3:50
    is the following. I'm going to make a
    vector, called average, And I'm going to
  • 3:51 - 3:56
    start off with just a bunch of 0s in it.
    And what I'm going to do with this vector
  • 3:56 - 4:01
    is after I've done computing the signal
    I'll say well my average is what it was
  • 4:01 - 4:07
    before plus this UTN. We'll just keep
    stacking the information in it. And at the
  • 4:07 - 4:13
    very end, after done this 30 times, we go
    through this loop 30 times, keep stacking
  • 4:13 - 4:17
    my average information there. At the end
    I'm just going to take this signal, and
  • 4:17 - 4:23
    divide by the total number of times I did
    this, right. So I could say, alright well,
  • 4:23 - 4:31
    how about we do this? Average is equal to
    absolute value of. So first I'm going to
  • 4:31 - 4:39
    shift it. I took 30 slices so just divide
    by 30 we'll make this a little more
  • 4:39 - 4:49
    general in a minute actually let's do the
    following. so we took 30 realizations is
  • 4:49 - 4:56
    a, I don't like to make variable names
    that long. Cuz I misspelled them that
  • 4:56 - 5:01
    long. so what I'm going to do is I'm going
    to take, I'm going to basically, remember
  • 5:01 - 5:06
    av is basically I've added it all
    together, by the way you don't add the
  • 5:06 - 5:12
    absolute value, okay? So I'm like you take
    the, , absolute value of each, an add them
  • 5:12 - 5:16
    together you take the raw signal,
    otherwise you've, the minus and plus's
  • 5:16 - 5:20
    that are there don't cancel, it's all
    positive, and it all adds up and it'll
  • 5:20 - 5:25
    look like no it's worse if you take more
    data, right? It should always be better
  • 5:25 - 5:30
    you sample 30 times, you got 30 things now
    to make a decision with, right? Okay, so I
  • 5:30 - 5:34
    add them all together. I'm going to ask
    that you shift it, take steps of five,
  • 5:34 - 5:42
    divided by the realization and I want to
    plot that, okay? So, let's go ahead and
  • 5:42 - 5:51
    plot it. All right, so here's why I don't
    have a plot in here first. The original
  • 5:51 - 6:03
    signal. The absolute value at oop. So this
    is my perfect signal, we crop that in red.
  • 6:03 - 6:07
    So remember what I did is I, before I
    polluted this thing with noise, I had
  • 6:07 - 6:12
    this, I know what the answer's supposed to
    be, right, and I've added noise to it. So
  • 6:12 - 6:16
    this is what the answer's supposed to be.
    That red line is going to come out, okay?
  • 6:17 - 6:24
    Now, let's look at this compared to the
    average, which is I added everything up,
  • 6:24 - 6:29
    divided by the total number of
    realizations, and I'm going to plot that
  • 6:29 - 6:41
    in black. Okay, and by the way, let me
    plot a single realization. If, if we go
  • 6:41 - 6:46
    through this loop, we went through this
    loop from J equals one to realizations.
  • 6:46 - 6:52
    The last time we went through the loop we
    had this thing called UTN. So that was
  • 6:52 - 6:58
    just one example of realization. Let's
    also plot that. So, KS versus the absolute
  • 6:58 - 7:08
    value of, and I, FFT shift of ETN, there
    and we'll plot that in yellow. I want it
  • 7:08 - 7:15
    to be sort of subtle. Okay, how about
    cyan? Okay, I want it to be sort of not a
  • 7:15 - 7:23
    strong, dominant color. Or else, it'll
    take up the whole picture. Okay, so first
  • 7:23 - 7:31
    of all, so let's talk about this picture.
    The psy N is one measurement. My last one.
  • 7:31 - 7:38
    I took 30, that's what the psy an is. The
    red is the exact answer and the black.
  • 7:39 - 7:46
    That's averaged over 30, okay? Actually,
    that's not so bad look at that kind of
  • 7:46 - 7:50
    get's my peak, right? Let's see how well
    we can do. So right, so un fact, what,
  • 7:50 - 7:54
    here's what I'm going to do. We're going
    to start looking at realizations. What
  • 7:54 - 7:58
    happe ns if I have one realization, were I
    get the blue? If I have two, how well do I
  • 7:58 - 8:02
    do? You know and then we'll start stepping
    it up to see how well does this converge.
  • 8:02 - 8:07
    What's the answer if I have a thousand
    reali, you know, a million, okay? What's
  • 8:07 - 8:11
    the answer of a thousa, infinity. Sorry,
    that's the answer I was looking for. My
  • 8:11 - 8:16
    daughters their nine and six. And their
    trying to understand this thing called
  • 8:16 - 8:20
    infinity. They've heard of it like, my
    youngest daughter, six, is like what
  • 8:20 - 8:25
    happens if you, and she always makes up
    these toy problems. Like, you know ten
  • 8:25 - 8:30
    billion 35, is that bigger than infinity?
    . Now, all you got to go figure what
  • 8:30 - 8:35
    happens though if you multiply that plus
    twenty . The older one king of gets at me,
  • 8:35 - 8:39
    be a little pissed and the younger one,
    she's, she, she's there, gettin in concept
  • 8:39 - 8:45
    infinity, and if you go to infinity. That
    red line will be black. The black line
  • 8:45 - 8:50
    will go red to the red line. And you had a
    question. No. Yes. Okay. Yes. Why don't
  • 8:50 - 8:55
    you need to FFT shift to average? Oh, we
    did already. I did. You did it when you
  • 8:55 - 9:01
    add it . Yeah. I . So now, so now let's
    look at this thing here. And, in fact, you
  • 9:01 - 9:06
    know what? This is going to be pretty
    sweet. We're going to make a little movie.
  • 9:06 - 9:13
    Ready? You're clearly not. But anyway,
    okay. . Alright, let's, let's try to do
  • 9:13 - 9:18
    this. Let's put this inside the loop. And
    I will plot it inside the loop. So when J
  • 9:18 - 9:24
    is one, we're going to plot this, hold.
    And so then we're going to do this pause
  • 9:24 - 9:29
    for half a second. And so when it goes
    through the first time, you'll see. In
  • 9:29 - 9:34
    fact, what we're going to do, is take out
    the cyan line, that's the individual run.
  • 9:34 - 9:39
    And all we're going to plot is.
    Essentially the average verses the what
  • 9:39 - 9:48
    were suppose to get ready? Okay let's see.
    J, thanks. Gary, any, anybody else, I
  • 9:48 - 9:55
    think that, hopefully is it. And now,
    we're going to go also through and do this
  • 9:55 - 10:06
    a hundred times. Oh yeah, it's not a good
    idea either, right? Hold on, hold on. Oh,
  • 10:06 - 10:13
    so I, I just, I should call this something
    else. How about that? I faked my code out.
  • 10:13 - 10:19
    Thank you. I have tw o, okay? Are we
    ready? I think we're ready to push the go
  • 10:19 - 10:26
    button. It will, hold on, here it, I got
    pull this in so you can see it, oh come
  • 10:26 - 10:31
    on, come on, no, okay, now I got to kill
    it, okay, there it is okay, fine, it's
  • 10:31 - 10:37
    going through, see that, see what's
    happening. Dang. I know what's it look
  • 10:37 - 10:47
    like its doing to you. Okay it's looking
    pretty good to me. Is it looking good to
  • 10:47 - 10:53
    you? I don't know what realization we're
    on. And what you can see, as we take more
  • 10:53 - 10:58
    and more realizations, right? We take more
    and more averages, we keep sampling this
  • 10:58 - 11:04
    thing out. The noise cancels itself out.
    And you basically get the black line is
  • 11:04 - 11:09
    just folding right on to the red but it's
    suppose to. There's a real signal in
  • 11:09 - 11:14
    there, okay? Now, if there was no signal
    in there it would all just go to zero.
  • 11:14 - 11:19
    Okay, so this is another way to take your
    data subtract the noise out. You know
  • 11:19 - 11:24
    something about noise make use of it. If
    there's anything in the problem that
  • 11:24 - 11:29
    you're not making use of you're probably
    not doing the problem right, okay? Every
  • 11:29 - 11:34
    piece of information you have should be
    used. Here we're using information now
  • 11:34 - 11:40
    about the noise. Okay, after a hundred,
    this is what you get. So, this can be like
  • 11:40 - 11:45
    your dog problem. Your dog problem is the
    following, right? You're going to first of
  • 11:45 - 11:50
    all, I haven't told you what the center
    frequency of your dog problem is. Here I
  • 11:50 - 11:54
    kind of knew. You know, I embedded, I have
    the answer, right? It's on my computer. I
  • 11:54 - 11:58
    said make a little signal right there in
    the middle of your domain. I don't do that
  • 11:58 - 12:02
    with the dog problem. I make it up, and I
    don't tell you where it is. So you've got
  • 12:02 - 12:07
    to figure out where I should even filter,
    right? All right, so in this process you
  • 12:07 - 12:13
    notice if I sample a lot, I clearly have a
    spike right there. So even if I didn't
  • 12:13 - 12:19
    know where to filter I'd say Oh, maybe I
    should filter right around here. There
  • 12:19 - 12:24
    seems to be something there that's not
    just noise. We go that?
Title:
W01_L03_P02 - Convergence to signal through repeated sampling

English subtitles

Revisions