How can I integrate a multivariable function that includes Dirac delta?

16 次查看(过去 30 天)
I'm trying to integrate an expression that includes a Dirac delta function, but the "integral" function (as well as integral2 and integral3) isn't handling the Dirac delta correctly.
For example,
f = @(x) dirac(x);
q = integral(f,-100,100)
gives me an incorrect answer of 0, while
p = int(dirac(x),x,-100,100)
gives me a correct answer of 1.
Is this just a factor of the integral function using numerical integration? If so, any recommendations for how to integrate multivariable functions with a Dirac delta in MATLAB?

采纳的回答

Walter Roberson
Walter Roberson 2016-2-14
When you use integral() you need to add Waypoints corresponding to everywhere the dirac changes between zero and non-zero, because each dirac is a discontinuity.
  3 个评论
Walter Roberson
Walter Roberson 2020-11-14
Good question, Rupsagar Chatterjee . I am seeing seemingly contradictory explanations of waypoints, and as I dig into the code, it does not look to me as if the function gets executed at the waypoints exactly.
Walter Roberson
Walter Roberson 2020-11-14
Ah, the documentation says,
Do not use waypoints to specify singularities. Instead, split the interval and add the results of separate integrations with the singularities at the endpoints.
This would mean that in your example you should calculate
integral(f,-1,3) + integral(f,3,4) + value associated with f(3)
When I say value associated with f(3), I do not mean f(3) itself, since dirac(0) is classically infinity; you would need to know to use the value associated with the distribution dirac(0), which is to say 1, multiplied by any associated constant or function value...
This is, of course, a nuisance, and the value to be associated with the point is not always obvious.
My summary... integral() appears to be unable to integral dirac() properly in practice. :(

请先登录,再进行评论。

更多回答(1 个)

Matt J
Matt J 2016-2-14
编辑:Matt J 2016-2-14
So you want to do symbolic double and triple integrals, etc...? If so, can't you apply int() several times in succession?

类别

Help CenterFile Exchange 中查找有关 Special Functions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by