How do you do a numerical integration of a delta function in MATLAB?
3 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Star Strider
on 4 Dec 2016
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.
3 Comments
Walter Roberson
on 4 Dec 2016
Heaviside and Dirac Delta have discontinuities. The integral2() function is not designed to deal with discontinuities. The integral() function can handle some forms of discontinuity provided that you supply waypoints
More Answers (1)
Walter Roberson
on 4 Dec 2016
Sometimes you need to rewrite integral2 in terms of nested integral() so that you can pass in the waypoints option
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!