I think everything is fine, but note that the output of not is a logical s array:
Example:
a = [0, 1, pi] b = not(a) c = double(b) whos
Output:
a = 0.00000 1.00000 3.14159 b = 1 0 0 c = 1 0 0 Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== a 1x3 24 double b 1x3 3 logical c 1x3 24 double Total is 9 elements using 51 bytes
So, if the inputs are double s, I would define the discrete Dirac delta function as follows:
ddirac = @(x) double(not(x));
or
function y = ddelta(x) y = double(not(x));
source share