0
$\begingroup$

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]
mask[x, y, \[Sigma]1, \[Sigma]2]

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.

Please help. I'm really stuck.

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]
mask[x, y, \[Sigma]1, \[Sigma]2]

Distribution Function Current Mask Function Error

$\endgroup$
  • $\begingroup$ Could you use KernelMixtureDistribution instead? $\endgroup$ – Chris K May 5 at 22:00
  • $\begingroup$ I don't know what that is? How it would work? $\endgroup$ – Lil Coder May 5 at 22:01
  • $\begingroup$ Could you explain a bit more about what you want the output to be? $\endgroup$ – Chris K May 5 at 22:10
  • $\begingroup$ 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/… $\endgroup$ – Lil Coder May 5 at 22:21
3
$\begingroup$

Something like this?

pts = {mc, mR1, mR2, mR3, mL1, mL2, mL3, mU, mD};
ThreeDnd[x_, y_, pt_, σ1_, σ2_] := 
  PDF[BinormalDistribution[pt, {σ1, σ2}, 1/2], {x, y}];
Plot3D[
  Evaluate[Sum[ThreeDnd[x, y, pt, 5, 5], {pt, pts}]]
, {x, 100, 300}, {y, 100, 200}
, PlotRange -> All, PlotPoints -> 100]

Mathematica graphics

$\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.