0

when I have two array x1, x2 and I write this code :

n=len(x1)
p=len(x2)
S=convolve1d(x1,x2,mode=‘constant’)

mathematically S is equal to what using x1,x2,n,p ?

and thank you

1 Answers1

0

Have you read about convolution? Formula is in Discrete convolution part.
It's rather complex thing...

In layman's term it might be considered as moving weighted average when one array (weights) slides along another.

MBo
  • 77,366
  • 5
  • 53
  • 86
  • First of all, thank you for your answer . I know about convolution and the meaning and the formula of it but mode='constant' what change in the normal convolution. That's new result of this convolution. And thank you again. – youssef boutaleb Oct 04 '22 at 07:02
  • Here `(,mode=‘constant’, cval=0 by default)` input is extended by zero values, so [1,2,3] becomes [0, 0, 1, 2, 3, 0, 0] before calculation – MBo Oct 04 '22 at 08:05
  • wow , so if I have x1=[a0,b0,c0] and x2=[a1,ab1] so s= x1[i]*x2[n-i] with i in ]-oo,+oo[ and x1 will be equal to [......0,0,0,a0,b0,c0,0,0,.......] – youssef boutaleb Oct 04 '22 at 08:55
  • Virtually - yes. Zero-extended array might be used for calculated (I don't know how it is really implemented), but x1 remains the same [a0,b0,c0] – MBo Oct 04 '22 at 09:24
  • If some answer is helpful, you can [accept it with green mark](https://stackoverflow.com/help/accepted-answer) – MBo Oct 06 '22 at 08:15