# Plot transition from pulse to Dirac delta spike

I am trying to create a Manipulate that will take a translated pulse (u[t-t0]-u[t-t0-ϵ]?/ϵ to smaller values of ϵ. My code accomplishes that, but at some point the resulting plot just disappears. Actually, I don't mind that if I could figure a way to display a Dirac delta spike at t0. I need a conditional to determine when ϵ is too small to plot the pulse, then I need a plot of a spike at t0.

My code is below:

Manipulate[
u[t_] := UnitStep[t];
Plot[{1/ϵ (u[t - t0] - u[t - t0 - ϵ])}, {t, 0,
Max[1.5, 1.5 ϵ]},
PlotRange -> {-0.5, Max[1.5/ϵ, 1]}, Exclusions -> None,
PlotStyle -> {Thick, Red}, LabelStyle -> {Bold, 12}],
{{ϵ, 0.5}, 0.001, 1, 0.001, Appearance -> "Labeled"},
{{t0, 0.5}, 0, 1.0}
]


The disappearance of the pulse seems to depend on the value of t0. This complicates matters even more.

• How would you show a Dirac delta on a graph? – Mirko Aveta Nov 22 '16 at 23:45
• with a vertical line with base at the coordinate (t0,0) and end at some (t0,x0) for some large value of x0. – Stephen Nov 22 '16 at 23:53
• Replace Exclusions -> None with Exclusions -> {t0, t0 + ϵ}, ExclusionsStyle -> Directive[Thick, Red]. – Rahul Nov 23 '16 at 0:39

If the goal is just to graphically motivate the idea, then may be this would also be an option

Manipulate[
Graphics[
{
Red, Thick
,
If[
e > 0.02
, Line[{{0, 0}, {t0, 0}, {t0, 1/e}, {t0 + e, 1/e}, {t0 + e,
0}, {2, 0}}]
, Arrow[{{t0, 0}, {t0, 20}}]
]
}
, PlotRange -> {{0, 2}, {0, Max[1.5, Min[1.5/e, 20]]}}
, AspectRatio -> 2/3
, Axes -> True
]
, {{e, 0.1}, 0.01, 0.1}
, {t0, 0, 2}
] • Good idea to avoid the UnitStep function – Stephen Nov 23 '16 at 14:41
Manipulate[u[t_] := UnitStep[t];
If[ϵ >= 0.01,
Plot[{1/ϵ (u[t - t0] - u[t - t0 - ϵ])}, {t, 0,
Max[1.5, 1.5 ϵ]},
PlotRange -> {-0.5, Max[1.5/ϵ, 1]}, Exclusions -> None,
PlotStyle -> {Thick, Red}, LabelStyle -> {Bold, 12}],
Plot[0, {t, 0, Max[1.5, 1.5 ϵ]},
PlotRange -> {-0.5, Max[1.5/0.005, 1]}, Exclusions -> None,
PlotStyle -> {Thick, Red}, LabelStyle -> {Bold, 12},
Epilog -> {Directive[Thick, Red],
Line[{{t0, 0}, {t0, Max[1.5/ϵ, 1]}}]}]], {{ϵ,
0.5}, 0.001, 1, 0.001, Appearance -> "Labeled"}, {{t0, 0.5}, 0,
1.0}] 