Plotting Dirac delta function in Mathematica.

• Apr 10th 2011, 05:00 AM
sedam7
Plotting Dirac delta function in Mathematica.
Hello,

I'm trying to check my work, but having problems with plotting in Mathematica... Until now i just used Heaviside[ ] function and did ok... but I can't get to plot Dirac... i tried to do it and just can't... please someone help :D

I'm trying to plot these signals....

$\displaystyle h(t) = \delta u (t+2) + 2\delta u(t+1)$

and

$\displaystyle h(t) = \delta u(t-1) -\delta (t-3)$
• Apr 11th 2011, 01:23 AM
CaptainBlack
Quote:

Originally Posted by sedam7
Hello,

I'm trying to check my work, but having problems with plotting in Mathematica... Until now i just used Heaviside[ ] function and did ok... but I can't get to plot Dirac... i tried to do it and just can't... please someone help :D

I'm trying to plot these signals....

$\displaystyle h(t) = \delta u (t+2) + 2\delta u(t+1)$

and

$\displaystyle h(t) = \delta u(t-1) -\delta (t-3)$

What do you expect the plot to look like? You do know what the Dirac delta is?

CB
• Apr 11th 2011, 01:59 AM
Ackbeet
Note that in Mathematica,

$\displaystyle \delta(x)\leftrightarrow\text{DiracDelta}[x].$
• Apr 11th 2011, 04:29 AM
CaptainBlack
Quote:

Originally Posted by Ackbeet
Note that in Mathematica,

$\displaystyle \delta(x)\leftrightarrow\text{DiracDelta}[x].$

But how will M. plot that (if at all), an upward pointing arrow at x=0? Wolfram Alpha certainly does not want to plot it!

CB
• Apr 11th 2011, 04:53 AM
Ackbeet
Mathematica just shows the axes. There's no line or arrow or anything. Here's a method for plotting the DiracDelta as an arrow:

<<GraphicsArrow
PlotOne=Plot[DiracDelta[x-1],{x,0,2}]
PlotTwo=Show[Graphics[Arrow[{1,0},{1,1}]]]
Show[PlotOne,PlotTwo]

That will give you an arrow going from the point <1,0> to the point <1,1>, representing the delta function $\displaystyle \delta(x-1),$ of "strength" 1.

If you wanted to generalize, you could let

MyDiracDelta[Strength_,a_]=Arrow[{a,0},{a,Strength}]