what happens when you reach the last two entries of the signal? how do you apply the filter then?
There's a few reasonable things you could do. The easiest thing would be to not apply the filter at all, so the result would have 2 fewer entries than the original signal. You could also pad the signal with 0s, or assume that the signal is periodic, so that in this case the first entry out of bounds would be 1, and then 3, etc.
@ jeshlee121 You can do zero padding, and there are also other methods: add a 1 at the very front and add a 4 in the end, or wrap around, or just reduce the size of the result if you do not want to add anything to the signal.