delta funtion in matlab

The delta function is not a function in the usual sense, it is a distribution or generalized function. However, we can simulate its behavior using dirac function in Matlab.

To create a delta function at a specific point a, use the dirac function with an argument of (t-a). For example, to create a delta function at a=0, type:

main.m
t = -1:0.01:1;          % define the range of t
y = dirac(t);           % create a delta function at t=0
plot(t, y);
117 chars
4 lines

This will create a plot of the delta function centered at t=0. You can change the location of the delta function by modifying the argument of the dirac function.

Note that the dirac function is not actually a function, but a distribution. Therefore, you cannot evaluate it at any point other than zero. However, you can use it in integrals and convolutions to achieve the desired effects.

related categories

gistlibby LogSnag