From: KH on
I want to find out the first derivative of Dirac delta function. I got the answer from the symbolic toolbox and then converted it into a function handle.

syms x
a = matlabFunction(diff(dirac(x-10)));

Matlab returns
a =
@(x)dirac(x-10,1)

The answer is fine. Then, let's say if you evaluate a(10), the error says too many input arguments.
Error in ==> sym.matlabFunction>makeFhandle/@(x)dirac(x-10,1)

Can anyone tell me if it is an inherent error to evaluate the derivative of Dirac delta function in Matlab?

Thanks
From: Roger Stafford on
"KH " <jambanova(a)hotmail.com> wrote in message <i3ekc4$fe4$1(a)fred.mathworks.com>...
> I want to find out the first derivative of Dirac delta function. I got the answer from the symbolic toolbox and then converted it into a function handle.
>
> syms x
> a = matlabFunction(diff(dirac(x-10)));
>
> Matlab returns
> a =
> @(x)dirac(x-10,1)
>
> The answer is fine. Then, let's say if you evaluate a(10), the error says too many input arguments.
> Error in ==> sym.matlabFunction>makeFhandle/@(x)dirac(x-10,1)
>
> Can anyone tell me if it is an inherent error to evaluate the derivative of Dirac delta function in Matlab?
>
> Thanks
- - - - - - - - - - -
The Dirac delta function only becomes significant for non-Riemann type integrals where single points are allowed to have finite non-zero measure. If you say dirac(0) it will give inf as the answer but that does not reveal its true meaning. You could not put that value into an ordinary numerical integration and get a correct answer.

In the case of the derivative of the dirac function, it would have to have the property that some kind of double integration of it would give a finite answer at the value x = 0. You cannot expect anything reasonable to come of trying to evaluate such a derivative at the point 0. If it were to issue an inf value, that would be very short of the reality.

The error message you received is probably due to the symbolic toolbox creators never having expected anyone to make such a weird request. If they were to anticipate it, the message could well read something like this: "Never do that again!"

Roger Stafford