Hi everybody. Now we are going to talk about convolutions and linear systems. If you've watched the functions are vectors tutorial, and it made sense, then this shouldn't seem too crazy. It relies heavily on the concept of projecting one function onto other. Okay, what does a linear system do? Or the technical engineering term for this is Linear Time Invariant system, or LTI if you're looking for search terms to Google later. But what does a linear system do? Well, our input is some signal as a function of time. So t is our x-axis, and let's just say the input signal is x. And I don't know what it looks like, maybe something like that. So that's our input. This is a Linear system and our output is another signal, another function, something like that. So the linear system takes in a function x of t and it spits out a function y of t. When you learn about a new system or a new operation, it's always important to keep track of the nature of the input and output. That is the first step to resolving confusion. So, a linear system take as input a function of time and its output is also a function of time. So how is the output generated? What we say in Neuroscience and Engineering, and probably a few other things, is that the output is a filtered version of the input. So filtered is the key word. And we name the filter f of t. With a more mathematical vocabulary, you would say that the output is the convolution of the filter and input. So, to get the output, you convolve the filter with the input. So this is probably best explained through an example. Let's say we have an input signal. So, here we're going to do an example. We have an input signal, that looks something like that. Who knows where it came from, just some input signal and we're going to stick it through this linear filter or this linear system and try to figure out what the output is going to look like. Now how do we characterize the linear system? We characterize the linear system by its filter, f of t. So let's say our filter looks something like this. This is t and this is f(t). Let's say that the filter is 0, for times really really far in the past, and then for times just a little bit in the past, maybe at minus 1, it goes up to the value of 1, and then at 0 it drops down to the value of minus 1, And then it comes back to 0 and stays at 0 for all of eternity. That's what our filter looks like. We want to figure how do you get y(t) from x(t), and f(t). So let's go through things one step at a time. Let's say we're trying to figure out y(5). So we're trying to figure out the value of our output at time five seconds, for example. How do we do this. Well, first we have to pick a window. Our filter is let's say this was also one second, no let's, let's say this was 0.5 seconds and this was minus 0.5 seconds centered at zero. So our window is the length of our filter which is just one second. So that will be the length of the window. So what do I mean when I say window, why is that a useful concept. What it means is that, if we're trying to find y(5), first we look up x(5) which is maybe, 5 is right there. And we draw a window around x(5). Since our filter is centered at zero we're going to center our window around x(5), so this is the window, around x(5). Now what we're going to to do is draw the filter, in right there, just like that. So that's our f(t). So y(5) is equal to the projection of f(t) onto x(t) in that window. So how do we figure out the projection of f(t) onto x(t)? Well, simple, we multiply f(t) by x(t) in that window, and then we take the integral. So what do we have here? x(t) is negative, f(t) is positive, so that value will be something maybe over here. And in this section in the second half, x(t) is negative and f(t) is negative. So we'll switch up here and do something positive. So, that's the product of x(t) and f(t), where f(t) is centered at t=5. To get the final value of the projection we then take the integral of that product. And it actually looks like in this case the integral's going to cancel out. So it'll be somewhere near zero. So the integral with x(t) and f(t) dt, over that window, is something like, maybe not quite zero, maybe it's minus 0.2, and that's it. That's our y(t). It was the projection of our filter onto x(t), where we center the window at the current time. So that equals -0.2. Not too bad right? What if we wanted to find y(6)? Now what we do as again we find t equals six maybe over here. We select our window [SOUND] draw the filter in the window. Multiply the curves together so now its maybe big negative, small positive, take the integral. You take the integral and the integral now equals maybe -0.4. And that's it, y(6)=-.4, and you can do that, and you can do this at any point in time, and what you're linear system does it is does at every point in time. So how it works is that. You'd pick up your filter and you place it over x(t) and you slide it along very slowly and at every point you notice where, or you write down where the center of the filter is, you figure out what your window is, and you do the projection of your filter onto x(t) in that window. And you write down your answer. That's y(t). And then you slide it along just a little bit. Do the same thing, except now the window is shifted. And write down your answer again. And that's your next y(t). And you can go through this and do the whole thing to get an entire signal y(t). So let's zoom in and go over just one more time. So here, of course that's t, here is x(t). Some kind of noisy sign wave like that. We have our filter, this is f(t), sorry we used blue before. f(t), that's t, and we wanted to figure out y(t). So what you do. Let's say t=3, find 3. Draw your window. Remember the window is the width of your filter, of the non-zero part of your filter. You draw the filter within the window, multiply the filter and the input signal together within that window and do the integral. And that gives you y(t), so this is pretty close to zero again, y(t) down there. Actually, maybe it's a little more than zero. So that's y(3), 3, y(t) and that's y(3). If we do the same thing over here, draw the filter, calculate the product, do the integral and get a new point on your output graph. So maybe this is y(6). And if you were to do this for every point in time, you might get something that looked like that. So not too hard. All you do is that you slide the window along and you calculate the projection of the filter onto the input signal. So what is the filter actually doing? What kinds of inputs will give it large outputs. For example, can you guess when y(t) would be the highest? And I've kind of, I've kind of drawn it here. So you can already take a good look and get a good idea. And the answer is that y(t) is the highest, in this example, anyway. At t equals, what would this be? Maybe t=4. This is when y(t) is the highest so y(4) is highest. This is because if we were to draw our filter over t=4, so just like that, and calculate y(t) from there. What do we get? Well, in this first half, the filter and x(t) are positive, so we get a positive signal. And in the second half, the filter and x(t) are both negative, so we also get a positive signal when we do the product. Therefore when we calculate this integral we're going to get a very large number, much larger than when we had done the projections at different parts of the signal. So at this zero crossing right here where it's going, where this input signal's going from a positive number to a negative number that's where we get the highest output of our filter. And can we understand this in sort of a pictorial way rather than actually going through and doing the integrals at all these points? Can we just look at our filter and look at our signal and get some idea of what will be going on? And the answer is yes, and the reason is that more or less a filtering system or a linear system is looking for parts of the inputs, parts of that resemble the filter. So the more the input signal resembles the filter, the higher your output signal will be. So, if you look at our filter up here, you will see it doesn't, none of the actual inputs stay too close to the filter, but if we find the part of the input signal that looks the closest to the filter, which would be the one where, the one over here around this zero crossing, that is going to be the signal that yields the highest output. Because it is a signal that, it is the part of the signal that looks most similar to the filter. Because that's the case, because our linear system is looking for certain features of the input signal, sometimes we call a linear system a feature detector and this means that the liner systems responds most strongly when it encounters a part of the input that looks like it's filter. So the filter describes the feature that the system is looking for. And in this week's lectures, we talked about ways of trying to just start with the output and the input and try to figure out what feature the system is looking for. So we try to figure out what filter the system is using to go from its input to its output. And in neuroscience you can use methods like reverse correlation or spike-triggered averaging. Or spike-triggered covariance analysis to estimate what the filter looks like. One last note that's not super important for our purposes, but if you go into an engineering field after this or have come from an engineering field after this, just be aware that sometimes, when you actually see the math written out, they will draw the filters backwards. Meaning that they're flipped around the y axis. And this is just, kind of a convention people use that makes writing out the integral a little bit easier. So sometimes, for example, you would see a filter like this, like the one we've talked about drawn like that instead. And if it's drawn like that all that means is that they would reverse it to the blue filter before they actually dragged it along the input signal. That's just a convention to be aware of. You don't need to worry about it too much, or even at all for this course, but sometimes that happens. Okay, that's it for now. Thanks, guys. See you next time.