MATLAB: How do you do a numerical integration of a delta function in MATLAB

delta functionintegral

Say I have a function f(x,y) and a number A. My function g(x,y)=1 when A-f(x,y)>0 and 0 when A-f(x,y)<0 and 0 when A-f(x,y)=0. I would like to do a double integral over x and y (x goes from 0 to 1, and y goes from x-1 to -x+1) of the delta-like function g(x,y).
I am trying to use integral2, but I don't know what function in matlab I could use for g(x,y).
Thanks!

Best Answer

You seem to have defined a step (Heaviside) function, not a delta function. The easiest way to do the integration is to integrate separately for ‘A-f(x,y)>0’ and ‘A-f(x,y)<=0’, then sum them.
I don’t understand what ‘g(x,y)’ is doing, because it only appears qualitatively in your description, so I didn’t include it.