4
$\begingroup$

I have two sets of data in the form

a={{.1,2},{.2,3},{.3,4},{.5,6}}

b={{0,8},{.1,4},{.2,7},{.3,1},{.5,10},{.6,3}}

Both data sets have even spacing, although the b dataset has significantly many more data points at higher and lower values of x. How do I convolve these data sets?

Convolve[a,b] only works if I use just the y values of the datasets. Is there a way to convolve this data while still keeping these x values?

$\endgroup$
  • $\begingroup$ Convolve doesn't work at all. It's for symbolic convolution. ListConvolve works, but you can't keep the x values. You'll need to re-add them afterwards. $\endgroup$ – Szabolcs Feb 20 '14 at 19:56
  • $\begingroup$ Your data sets don't have values at .4... the data needs to be defined at all times in a regularly spaced intervals in order for convolution to be defined. $\endgroup$ – bill s Feb 20 '14 at 20:09
  • $\begingroup$ Sorry for the lack of clarity. Yes I am using ListConvolve, and the data I have written there is just an example. My actual data sets are several hundred thousand points. I will try adding the x coordinates back into my ListConvolved data set. $\endgroup$ – ahle6481 Feb 20 '14 at 23:35
2
$\begingroup$

If you used ListConvolve, as mentioned by Szabolcs, you could get the following solutions.

a = {{.1, 2}, {.2, 3}, {.3, 4}, {.5, 6}};
b = {{0, 8}, {.1, 4}, {.2, 7}, {.3, 1}, {.5, 10}, {.6, 3}};
ListConvolve[a, b]

$\left( \begin{array}{c} 8.3 \\ 8.6 \\ 11.2 \\ \end{array} \right)$

Or

Table[ListConvolve[a, b, #], 1] & /@ Range[4]

$\left( \begin{array}{c} \left( \begin{array}{cc} 71.42 & 10.5 \\ 104.44 & 13.5 \\ 76.34 & 9.7 \\ 87.1 & 8.3 \\ 75.22 & 8.6 \\ 82.35 & 11.2 \\ \end{array} \right) \\ \left( \begin{array}{cc} 13.5 & 104.44 \\ 9.7 & 76.34 \\ 8.3 & 87.1 \\ 8.6 & 75.22 \\ 11.2 & 82.35 \\ 10.5 & 71.42 \\ \end{array} \right) \\ \left( \begin{array}{cc} 76.34 & 9.7 \\ 87.1 & 8.3 \\ 75.22 & 8.6 \\ 82.35 & 11.2 \\ 71.42 & 10.5 \\ 104.44 & 13.5 \\ \end{array} \right) \\ \left( \begin{array}{cc} 8.3 & 87.1 \\ 8.6 & 75.22 \\ 11.2 & 82.35 \\ 10.5 & 71.42 \\ 13.5 & 104.44 \\ 9.7 & 76.34 \\ \end{array} \right) \\ \end{array} \right)$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.