Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use 'not' as a discrete dirac delta function in Matlab?

Tags:

matlab

Can I use not as a discrete dirac delta function in Matlab?

The definition for the discrete dirac delta function is that for argument 0 it returns 1, and otherwise it returns 0. But that is exactly what the not function does in Matlab also!

Do you see any problems if I use not instead of writing my own dirac delta function? I am aware that Matlab has a dirac function, but that one is the continuous version - it returns infinity for 0 instead of 1.

like image 315
user2381422 Avatar asked Aug 21 '13 16:08

user2381422


People also ask

How do you represent a Dirac delta function in Matlab?

Description. d = dirac( x ) represents the Dirac delta function of x . d = dirac( n , x ) represents the n th derivative of the Dirac delta function at x .

Is Dirac delta function continuous?

The Dirac delta function, often referred to as the unit impulse or delta function, is the function that defines the idea of a unit impulse in continuous-time. Informally, this function is one that is infinitesimally narrow, infinitely tall, yet integrates to one.

Why is Dirac delta not a function?

The Dirac delta is not truly a function, at least not a usual one with domain and range in real numbers. For example, the objects f(x) = δ(x) and g(x) = 0 are equal everywhere except at x = 0 yet have integrals that are different.


1 Answers

I think it's OK, but note that the output of not is an array of logicals:

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 doubles, I would define the discrete Dirac delta function this way:

ddirac = @(x) double(not(x));

or

function y = ddelta(x)
y = double(not(x));
like image 191
kol Avatar answered Sep 18 '22 16:09

kol