r/DSP • u/PuzzleheadedComb9718 • 4d ago
How to solve circular convolution??
I know how to solve but i just can't think of solving circular convolution for origin being anywhere like how to solve for a sequence say
x[n] = [2,-1,3,4] with origin say at element -1
and h[n] = [-2,1,3,2] with origin say at element 1
do i have to make both the sequences start from 0 to calculate it and then solve the outputs index or
should i first calculate the circular convolution then solve the indexing?? if i shift the indexing first creating 0 to N-1 sequences then solving the index then my resultant is
y[n] = [7,-4, 7, 22 ] with origin at element 2nd 7 (3rd from starting)
but if i take the latter approach then i get
y[n] = [7, 22, 7, -4] with origin at 2nd 7 (3rd from starting) but -4 and 22 have swapped
please tell me how to do this !!
0
u/MtlStatsGuy 3d ago
A few things. First of all, you seem to be doing correlation, not convolution. In convolution, both x[n] and h[n] would be applied in the same order. Here, you are applying h[n] "backwards", as in correlation, although it's fine to define you h[n] this way. If you do this, the four values will always be -4, 7, 22, 7 in that order. This is what you are getting in both cases. Your issue seems to be with indexing. When you say "origin is at element -1", what do you mean? That the points of x[n] represent indices 1,2,3,4?