[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.00,0:00:04.52,Default,,0000,0000,0000,,So, before we start talking. A couple\Nthings that we want, you want to Dialogue: 0,0:00:04.52,0:00:09.23,Default,,0000,0000,0000,,understand. So, we talked about how to do\Nfiltering. So, you have this center Dialogue: 0,0:00:09.23,0:00:16.09,Default,,0000,0000,0000,,frequency, right? And you have this noisy\Nsignal. And let's say, in the frequency Dialogue: 0,0:00:16.09,0:00:23.91,Default,,0000,0000,0000,,domain, there's my version of noise, okay?\NYou get to all this junk, right? Any Dialogue: 0,0:00:23.91,0:00:29.78,Default,,0000,0000,0000,,ideas, you say is there anything there or\Nnot? And then, you would put like some Dialogue: 0,0:00:29.78,0:00:34.26,Default,,0000,0000,0000,,kind of filter cuz you know what\Nfrequencies you're going to look at. And Dialogue: 0,0:00:34.26,0:00:39.06,Default,,0000,0000,0000,,then, you basically multiply these two\Ntogether, kill everything off. Okay, so Dialogue: 0,0:00:39.06,0:00:44.18,Default,,0000,0000,0000,,that's one way to do things. Now, couple\Nthings to notice about this. First, I know Dialogue: 0,0:00:44.18,0:00:48.73,Default,,0000,0000,0000,,where to look. Now in a radar problem\Ngenerically, you don't know where to look. Dialogue: 0,0:00:48.73,0:00:53.69,Default,,0000,0000,0000,,But in your DOG problem, I'm not letting,\NI'm not telling you what frequency to look Dialogue: 0,0:00:53.69,0:00:58.41,Default,,0000,0000,0000,,for. You've got to find it, okay? There's\None other piece of information we haven't Dialogue: 0,0:00:58.41,0:01:02.71,Default,,0000,0000,0000,,used here, okay? The other piece of\Ninformation we haven't used here is, is Dialogue: 0,0:01:02.71,0:01:07.68,Default,,0000,0000,0000,,something about the noise itself. What did\Nwe say this noise was? We say this noise Dialogue: 0,0:01:07.68,0:01:12.70,Default,,0000,0000,0000,,was white noise. Now, the nice thing about\Ndetectors is you can keep often times keep Dialogue: 0,0:01:12.70,0:01:16.94,Default,,0000,0000,0000,,resampling things, right? So, for\Ninstance, if I'm in the radar problem, Dialogue: 0,0:01:16.94,0:01:24.63,Default,,0000,0000,0000,,right? Okay, that's my radar on top of a\Nmountain, and there's your airplane coming Dialogue: 0,0:01:24.63,0:01:30.40,Default,,0000,0000,0000,,in. Alright. That's a really bad airplane.\NBut anyway, there's my airplane coming in, Dialogue: 0,0:01:30.40,0:01:34.60,Default,,0000,0000,0000,,or missile, whatever happens to be and I'm\Ntrying to get this thing. I can keep, I'm Dialogue: 0,0:01:34.60,0:01:38.51,Default,,0000,0000,0000,,continually taking continually taking\Ninformation in on this. So, I'm sampling Dialogue: 0,0:01:38.51,0:01:42.32,Default,,0000,0000,0000,,not just once, not just twice, but I have\Na continual sample string, okay? So, I Dialogue: 0,0:01:42.32,0:01:46.22,Default,,0000,0000,0000,,haven't made use of that at all in this\Nfiltering problem. So, I want to try to Dialogue: 0,0:01:46.22,0:01:50.38,Default,,0000,0000,0000,,think about how to make use of that. The\Nfact is, when you have white noise, here's Dialogue: 0,0:01:50.38,0:01:55.40,Default,,0000,0000,0000,,the specifics about white noise. White\Nnoise is random. And, by the way, normally Dialogue: 0,0:01:55.40,0:02:00.36,Default,,0000,0000,0000,,when it's randomly distributed you say,\Nwell, okay. So, how did I do, do it in my Dialogue: 0,0:02:00.36,0:02:04.87,Default,,0000,0000,0000,,computer? I said, mean zero, unit\Nvariance. Okay? So, when I add two pieces Dialogue: 0,0:02:04.87,0:02:09.38,Default,,0000,0000,0000,,of noise together, they shou ld be\Nincoherent. If I have three, four, five, Dialogue: 0,0:02:09.38,0:02:14.40,Default,,0000,0000,0000,,six, none of it should be coherent. In\Nfact, I add a bunch of noise together and Dialogue: 0,0:02:14.40,0:02:19.33,Default,,0000,0000,0000,,I take its average and its average is\Nzero. Awesome. So I did one sample. What Dialogue: 0,0:02:19.33,0:02:24.74,Default,,0000,0000,0000,,if I took a bunch? Then, the idea would be\Nthat if I took a bunch of noise, then if I Dialogue: 0,0:02:24.74,0:02:29.37,Default,,0000,0000,0000,,add all of the noise together, it should\Nbe zero. And by the way, if it's not Dialogue: 0,0:02:29.37,0:02:34.53,Default,,0000,0000,0000,,noise, it won't go to zero. So, I'm going\Nto use that to your, to my advantage. But Dialogue: 0,0:02:34.53,0:02:39.68,Default,,0000,0000,0000,,really, that's like to your advantage,\Ntoo. Anything that's to my advantage right Dialogue: 0,0:02:39.68,0:02:44.83,Default,,0000,0000,0000,,now is to your advantage. Okay. The only\Nthing that's to my advantage and not to Dialogue: 0,0:02:44.83,0:02:50.28,Default,,0000,0000,0000,,your advantage is my, maybe the homework.\NCuz then I already wrote it. You got to do Dialogue: 0,0:02:50.28,0:02:56.69,Default,,0000,0000,0000,,it. So, okay. So, so we're going to try to\Nwork on that and see how that can work for Dialogue: 0,0:02:56.69,0:03:02.79,Default,,0000,0000,0000,,us, okay? So, what I want to do is write\Naother code today building upon what we Dialogue: 0,0:03:02.79,0:03:11.09,Default,,0000,0000,0000,,did last time with the aim of making, kind\Nof exploring this idea of what noise does, Dialogue: 0,0:03:11.09,0:03:17.58,Default,,0000,0000,0000,,okay? So, I'm going to turn the lights\Ndown in front. Now, you guys in the back Dialogue: 0,0:03:17.58,0:03:23.34,Default,,0000,0000,0000,,there, the TV screens, what do you got\Nthere on the TV screens? Chow, can you see Dialogue: 0,0:03:23.34,0:03:29.58,Default,,0000,0000,0000,,my can, computer? Alright, great. Okay.\NAlright. So, here we go. We're going to Dialogue: 0,0:03:29.95,0:03:35.15,Default,,0000,0000,0000,,start of with a little bit of code we had\Nlast time. So, here it is. Let's just go Dialogue: 0,0:03:35.15,0:03:40.65,Default,,0000,0000,0000,,through it again. You'll be writing a lot\Nof code like this in your homework, first Dialogue: 0,0:03:40.65,0:03:45.35,Default,,0000,0000,0000,,homework for instance. And of course,\Nhopefully everybody likes these commands, Dialogue: 0,0:03:45.35,0:03:50.25,Default,,0000,0000,0000,,clear all, close all, clc. This just\Nstarts us off on a fresh slate for the Dialogue: 0,0:03:50.25,0:03:54.51,Default,,0000,0000,0000,,code. And then here, I define a time\Ndomain. So, I'm going to sample my signal Dialogue: 0,0:03:54.51,0:03:58.50,Default,,0000,0000,0000,,for 30 units. Whatever that happens to be.\NLet's say, call it seconds. I'm going to Dialogue: 0,0:03:58.84,0:04:03.23,Default,,0000,0000,0000,,sample for 30 seconds. And what I want to\Ndo with that 30 seconds and see what's, Dialogue: 0,0:04:03.23,0:04:07.17,Default,,0000,0000,0000,,what's in that signal. So, I get to have a\Ncertain number of points I'm going to Dialogue: 0,0:04:07.50,0:04:11.78,Default,,0000,0000,0000,,sample with. So here, there's 512 points\Nand 30 seconds. So, I'd sample at that Dialogue: 0,0:04:11.78,0:04:19.14,Default,,0000,0000,0000,,rate, okay? And now, I can define my time\Ninterval as well as my frequency Dialogue: 0,0:04:19.14,0:04:26.73,Default,,0000,0000,0000,,components in, in that sampling. So here,\Nthi s T2 and T. So, remember the lin space Dialogue: 0,0:04:26.73,0:04:31.87,Default,,0000,0000,0000,,is a linear space that goes from -T over\Ntwo to T over two, so it's negative Dialogue: 0,0:04:31.87,0:04:37.25,Default,,0000,0000,0000,,fifteen to fifteen. And I break it up into\N512 plus one points. So, 512 points plus Dialogue: 0,0:04:37.25,0:04:42.16,Default,,0000,0000,0000,,the last point is the same as the first,\Nperiodic. Using, remember I'm using Dialogue: 0,0:04:42.16,0:04:47.57,Default,,0000,0000,0000,,Fourier modes, Fourier coefficients. Those\Nare all sines and cosines of two pi Dialogue: 0,0:04:47.57,0:04:52.77,Default,,0000,0000,0000,,periodic, okay? Whenever you use Fourier\Ncomponents, assumptions, periodic. So, I Dialogue: 0,0:04:52.77,0:04:58.69,Default,,0000,0000,0000,,got periodic and I throw away the last\Npoint by just taking the first one through Dialogue: 0,0:04:58.69,0:05:04.96,Default,,0000,0000,0000,,n here. So, T is what I really want. And\Nthen, I define my wave numbers or Dialogue: 0,0:05:04.96,0:05:10.85,Default,,0000,0000,0000,,frequency components, with two pi over T,\Nis there because the FFT thinks you're Dialogue: 0,0:05:10.85,0:05:17.13,Default,,0000,0000,0000,,working on a two pi periodic domain. So,\Nthis is a re-scaling. And you go from zero Dialogue: 0,0:05:17.13,0:05:21.05,Default,,0000,0000,0000,,to n / two -one, and to n over, -n / two\N-one. Dialogue: 0,0:05:21.06,0:05:25.74,Default,,0000,0000,0000,,These are like my cosine zero, my cosine\N1x, and my cosine 2x. And they're Dialogue: 0,0:05:25.74,0:05:29.96,Default,,0000,0000,0000,,integers. And why do I order them this\Nway? Remember, the FFT shifts things, Dialogue: 0,0:05:29.96,0:05:33.83,Default,,0000,0000,0000,,okay? Ot does, it does one of these. So,\Nyou've got your four components when you Dialogue: 0,0:05:33.83,0:05:38.39,Default,,0000,0000,0000,,do the FFT does that. Take a knife, cut it\Nin the middle of the main switches it Dialogue: 0,0:05:38.39,0:05:43.89,Default,,0000,0000,0000,,over. So is kn minus the number two to, n\Nover two. Yeah, so when you say that, Dialogue: 0,0:05:43.89,0:05:51.49,Default,,0000,0000,0000,,yeah, then I take away that shift. And now\Nit's just from -n over two to n over two, Dialogue: 0,0:05:51.49,0:05:57.35,Default,,0000,0000,0000,,but with a two pi over two factor in front\Nof it. Okay. Now, I'm going to define a Dialogue: 0,0:05:57.35,0:06:02.99,Default,,0000,0000,0000,,function, such. And it's Fourier transform\Nut, okay? So, we have everything we've Dialogue: 0,0:06:02.99,0:06:08.34,Default,,0000,0000,0000,,got. We got a function, we have this\NFourier transform. And now, what we want Dialogue: 0,0:06:08.34,0:06:13.71,Default,,0000,0000,0000,,to do, and let me bring this up a little\Nbit. Does that, so there is my function Dialogue: 0,0:06:13.18,0:06:18.20,Default,,0000,0000,0000,,and such. There is its Fourier transform.\NAnd I'm going to add some noise. There it Dialogue: 0,0:06:18.20,0:06:22.69,Default,,0000,0000,0000,,is. So, I take some, this is just going to\Nbe some coefficient. It's going to control Dialogue: 0,0:06:22.69,0:06:27.24,Default,,0000,0000,0000,,how much noise I want to throw on this.\NAnd notice the way I put white noise on, Dialogue: 0,0:06:27.24,0:06:34.18,Default,,0000,0000,0000,,you put it on the frequency domain. White\Nnoise is a collection, right? If, white Dialogue: 0,0:06:34.18,0:06:39.54,Default,,0000,0000,0000,,noise is all colors, right? So, there's\Nalso a thing called colored noise which Dialogue: 0,0:06:39.54,0:06:44.48,Default,,0000,0000,0000,,is, if you have certain frequen cy\Ncomponents that have noise in it, well, Dialogue: 0,0:06:44.48,0:06:50.04,Default,,0000,0000,0000,,around those frequencies or colors, you\Nwould add noise there. But if we do white Dialogue: 0,0:06:50.04,0:06:55.40,Default,,0000,0000,0000,,noises, all frequency components have\Nnoise, okay? So, what I do here is I go to Dialogue: 0,0:06:55.40,0:07:01.59,Default,,0000,0000,0000,,every frequency component and add a random\Nvariable. This is round in. It means zero Dialogue: 0,0:07:01.59,0:07:09.02,Default,,0000,0000,0000,,unit variants, okay? And I add both a real\Nand imaginary part. Just do my signal. So, Dialogue: 0,0:07:09.02,0:07:15.80,Default,,0000,0000,0000,,I've, I've modified my signal made it not\Nso nice. Yeah. Could you explain one more Dialogue: 0,0:07:15.80,0:07:20.90,Default,,0000,0000,0000,,time why you need to add the imaginary\Nnoise as well? Yeah. So, if you do not Dialogue: 0,0:07:20.90,0:07:25.99,Default,,0000,0000,0000,,have this imaginary piece, what you've\Nadded only is real components into your Dialogue: 0,0:07:25.99,0:07:30.50,Default,,0000,0000,0000,,noise. It makes it symmetric. Remember,\Nwhen think about your frequency Dialogue: 0,0:07:30.50,0:07:35.39,Default,,0000,0000,0000,,components, it's e to the i. When you do a\NFourier transform, it's e to the i Dialogue: 0,0:07:35.39,0:07:40.55,Default,,0000,0000,0000,,whatever the, the frequency component has\Nto be. Well, if you only add e to the i Dialogue: 0,0:07:40.55,0:07:46.52,Default,,0000,0000,0000,,with real component, then what happens is,\Nright? You're saying, okay, I'll add e to Dialogue: 0,0:07:46.23,0:07:51.75,Default,,0000,0000,0000,,the i. But then, e to the -i looks the\Nsame. So, what ends up happening then it, Dialogue: 0,0:07:51.75,0:07:57.34,Default,,0000,0000,0000,,at symmetric noise. You don't want to do\Nthat. And if you only add the imaginary Dialogue: 0,0:07:57.34,0:08:03.07,Default,,0000,0000,0000,,parts, you add a symmetric noise. So, you\Nadd both to get, so there's no correlation Dialogue: 0,0:08:03.07,0:08:09.08,Default,,0000,0000,0000,,between the cosine i omega terms and the\Ncosine -one omega terms, both of them get Dialogue: 0,0:08:09.08,0:08:14.17,Default,,0000,0000,0000,,different noise, okay? Alright. Good?\NAlright. Dealing with a lot of this Dialogue: 0,0:08:14.17,0:08:18.36,Default,,0000,0000,0000,,Hawaiian thing these days, I don't know\Nwhy I just developed it in last quarter Dialogue: 0,0:08:18.36,0:08:22.24,Default,,0000,0000,0000,,where I was doing a lot of this. It's a\Nlittle shocker, you know? So, if you see a Dialogue: 0,0:08:22.24,0:08:25.74,Default,,0000,0000,0000,,lot of that, I mean, I don't know what\Nthat means. Except I think maybe I'm Dialogue: 0,0:08:25.74,0:08:30.86,Default,,0000,0000,0000,,having a good time in class, yeah? Oh,\Nthat's not so good. Alright. we'll see how Dialogue: 0,0:08:30.86,0:08:36.56,Default,,0000,0000,0000,,long that lasts. But I, kind of like it.\NHawaii made me think of the sunshine, Dialogue: 0,0:08:37.17,0:08:43.03,Default,,0000,0000,0000,,that's a good thing to think about. Okay.\NSo then, I have my new signal, utn. Can Dialogue: 0,0:08:43.03,0:08:48.66,Default,,0000,0000,0000,,you guys still see my screen back there?\NOr is that me, there we go. Perfect. Dialogue: 0,0:08:48.66,0:08:54.51,Default,,0000,0000,0000,,Alright. u of n. u of n is my noisy\Nsignal. So let's plot these, just to take Dialogue: 0,0:08:54.51,0:09:00.31,Default,,0000,0000,0000,,a look. So you know, we'll subplot them.\NSubplot oh, by the way, see, I also want Dialogue: 0,0:08:59.92,0:09:05.06,Default,,0000,0000,0000,,to, remember I have this k of s here?\NThat's a shifted version, I want you to Dialogue: 0,0:09:05.06,0:09:11.52,Default,,0000,0000,0000,,just remember that I've already done that.\NSo, I'll make a subplot of two rows, one Dialogue: 0,0:09:11.52,0:09:18.70,Default,,0000,0000,0000,,column. And first, we're going to plot the\Noriginal signal, t versus u. And we'll Dialogue: 0,0:09:18.70,0:09:26.25,Default,,0000,0000,0000,,plot that in red. And then, we'll plot\Nthis noisy signal, t versus absolute value Dialogue: 0,0:09:26.25,0:09:36.27,Default,,0000,0000,0000,,of un, plot that in black. And then,\Nsecond subplot we'll plot, first of all, Dialogue: 0,0:09:36.27,0:09:43.62,Default,,0000,0000,0000,,we'll plot the nice spectrum, which is ks\Nversus the absolute value of ut which is Dialogue: 0,0:09:44.20,0:09:52.70,Default,,0000,0000,0000,,the transform. Oh, by the way, FFT shift\Nof ut. And plot that in red. And now, Dialogue: 0,0:09:52.70,0:10:01.66,Default,,0000,0000,0000,,we'll plot the noisy part which is ks\Nversus absolute value of FFT shift utn. Dialogue: 0,0:10:03.36,0:10:08.58,Default,,0000,0000,0000,,And I think, there we go. Alright. So,\Nwe'll just plot what these things look Dialogue: 0,0:10:08.58,0:10:18.06,Default,,0000,0000,0000,,like. Here they are. Okay. So, the red is\Nmy clean signal. The black is my muddled Dialogue: 0,0:10:18.06,0:10:24.36,Default,,0000,0000,0000,,signal because it got polluted with noise.\NThe red is my nice clean spectrum. And all Dialogue: 0,0:10:24.36,0:10:30.50,Default,,0000,0000,0000,,that blue is the fact that I added noise\Nat all these components. So, normally what Dialogue: 0,0:10:30.50,0:10:32.82,Default,,0000,0000,0000,,you're going to read from your detectors,\Nthe.