title: how to define a 2d discrete delta function that can take array input in matlab
body: <pre><code>function y = dd2(x1,x2)
  y=0;
  if x1==0 &amp;&amp; x2==0
    y=1;
  end
  </code></pre>
  
  <p>This would not work because the input cannot be an array.
  I hope to make it can work for an array X of 1*m, and an array Y of 1*n
  so when you dd2(X,Y) it creates a m*n matrix with 1 at the position where X=0, Y=0 and zero otherwise</p>
  
  <p>Is there any function that does this has already been implemented in matlab? (like a 2D discrete delta function) I didn't find it.. The dirac(x) would return inf which I want is zero. Is there a way to change the inf to 1? Thanks</p>