discret convolution works!
x: h: Share Link
x | x<0 | 0 | 1 | 2 | 3 | 4 | 5 | x>0 | x<0 | 0 | 1 | 2 | 3 | 4 | 5 | x>0 | |
x[n] | 0 | 1 | 2 | 2 | 1 | 0 | 0 | 0 | h[n] | 0 | 1 | -1 | 0 | 0 | -1 | 1 | 0 |
This returns the convolution at each point of overlap, with an output shape of (N+M-1,). At the end-points of the convolution, the signals do not overlap completely, and boundary effects may be seen. x*h=sum(x[m]*h[n-m])
Mode ‘valid’ returns output of length max(M, N) - min(M, N) + 1. The convolution product is only given for points where the signals overlap completely. Values outside the signal boundary have no effect.
conv1([1,2,2,1,0,0] , [1,-1,0,0,-1,1])=[1,1,0,-1,-2,-1,0,1,1,0,0]
y[0]=x[0]*h[0](1) =1
y[1]=x[0]*h[1](-1) + x[1]*h[0](2) =1
y[2]=x[0]*h[2](0) + x[1]*h[1](-2) + x[2]*h[0](2) =0
y[3]=x[0]*h[3](0) + x[1]*h[2](0) + x[2]*h[1](-2) + x[3]*h[0](1) =-1
y[4]=x[0]*h[4](-1) + x[1]*h[3](0) + x[2]*h[2](0) + x[3]*h[1](-1) + x[4]*h[0](0) =-2
y[5]=x[0]*h[5](1) + x[1]*h[4](-2) + x[2]*h[3](0) + x[3]*h[2](0) + x[4]*h[1](0) + x[5]*h[0](0) =-1
y[6]=x[0]*h[6](0) + x[1]*h[5](2) + x[2]*h[4](-2) + x[3]*h[3](0) + x[4]*h[2](0) + x[5]*h[1](0) + x[6]*h[0](0) =0
y[7]=x[0]*h[7](0) + x[1]*h[6](0) + x[2]*h[5](2) + x[3]*h[4](-1) + x[4]*h[3](0) + x[5]*h[2](0) + x[6]*h[1](0) + x[7]*h[0](0) =1
y[8]=x[0]*h[8](0) + x[1]*h[7](0) + x[2]*h[6](0) + x[3]*h[5](1) + x[4]*h[4](0) + x[5]*h[3](0) + x[6]*h[2](0) + x[7]*h[1](0) + x[8]*h[0](0) =1
y[9]=x[0]*h[9](0) + x[1]*h[8](0) + x[2]*h[7](0) + x[3]*h[6](0) + x[4]*h[5](0) + x[5]*h[4](0) + x[6]*h[3](0) + x[7]*h[2](0) + x[8]*h[1](0) + x[9]*h[0](0) =0
y[10]=x[0]*h[10](0) + x[1]*h[9](0) + x[2]*h[8](0) + x[3]*h[7](0) + x[4]*h[6](0) + x[5]*h[5](0) + x[6]*h[4](0) + x[7]*h[3](0) + x[8]*h[2](0) + x[9]*h[1](0) + x[10]*h[0](0) =0