# Arrays, Mapping, and Convolutions

I'm trying to create a function that convolutes a 3D Normal Distribution to the points listed below. However, I think I'm going about it in the wrong way.

When I try and convolve it with the points, listed as the delta function, it doesn't plot correctly.

I think I could try and rewrite it in terms of mapping the DiracDelta[] (Map[DiracDelta[x-#],array]?)to the points listed, but since its in two dimensions, I'm not sure how to make it work.

mc = {202, 155};
mR1 = {230, 100};
mR2 = {235, 123};
mR3 = {240, 150};
mL1 = {165, 139};
mL2 = {168, 169};
mL3 = {175, 188};
mU = {209, 175};
mD = {196, 112};

ThreeDnd[x_, y_, \[Sigma]1_, \[Sigma]2_] :=
PDF[BinormalDistribution[{0, 0}, {\[Sigma]1, \[Sigma]2}, 1/2], {x,
y}];
Plot3D[ThreeDnd[x, y, 5, 5], {x, -dm/2, dm/2}, {y, -dm2/2, dm2/2},
PlotRange -> All]

mask[x_, y_, \[Sigma]1_, \[Sigma]2_] := Convolve[
(DiracDelta[x - mc[[1]], y - mc[[2]]] +
DiracDelta[x - mR1[[1]], y - mR1[[2]]] +
DiracDelta[x - mR2[[1]], y - mR2[[2]]] +
DiracDelta[x - mR3[[1]], y - mR3[[2]]] +
DiracDelta[x - mL1[[1]], y - mL1[[2]]] +
DiracDelta[x - mL2[[1]], y - mL2[[2]]] +
DiracDelta[x - mL3[[1]], y - mL3[[2]]] +
DiracDelta[x - mU[[1]], y - mU[[2]]] +
DiracDelta[x - mD[[1]], y - mD[[2]]]),
ThreeDnd[x, y, \[Sigma]1, \[Sigma]2],
x, y,
z]

Plot3D[mask[x, y, 5, 5], {x, -dm, dm}, {y, -dm2, dm2},
PlotRange -> All]


The output should be a 3D distribution centered at each of the points.

I'll take this mask then multiply it with a Fourier transform.

Edit: I thought I'd try mapping the points to the delta distributions, but that doesn't seem to work either

Test2 = Map[(-# + {x, y}) &, {mc, mR1, mR2, mR3, mL1, mL2, mL3, mU,
mD}]
Test3 = Total[DiracDelta /@ Test2]
mask[x_, y_, \[Sigma]1_, \[Sigma]2_] := Convolve[
Test3,
ThreeDnd[x, y, \[Sigma]1, \[Sigma]2],
x, y]


• Could you use KernelMixtureDistribution instead? May 5, 2019 at 22:00
• I don't know what that is? How it would work? May 5, 2019 at 22:01
• Could you explain a bit more about what you want the output to be? May 5, 2019 at 22:10
• I want to essentially "map" the ThreeDnd function to the position of each of the points I've listed in my code. I thought I could achieve this by convoluting a delta distribution with those points with ThreeDnd If you check out my earlier post, you can see an image of what ThreeDnd plots. I'd like one of those centered at each one of the points. mathematica.stackexchange.com/questions/197755/… May 5, 2019 at 22:21

pts = {mc, mR1, mR2, mR3, mL1, mL2, mL3, mU, mD};