difference results from int and integral of delta function

Hello Matlab experts:
I am trying to calculate the integral of delta function, however I got two different answers. apparently answer 0 is wrong. Can anyone explain the difference for me?
really appreciate.
Regards
Method 1:
>> int(dirac(x), -inf, inf)
ans =
1
Method 2:
>> delta_fun = @(t) dirac(t);
>> integral(delta_fun, -inf, inf)
ans =
0
>> delta_fun(0)
ans =
Inf

1 Comment

In method 2 you are trying to do numeric integration on a symbolic function.

Sign in to comment.

Answers (0)

Asked:

on 5 May 2020

Commented:

on 5 May 2020

Community Treasure Hunt

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

Start Hunting!