How to plot a impulse unit function using Plots.jl and SymPy.jl?

Your derivative returns nan at both 2 and 5. This function gives it a value and then plots (the arrow works with GR at least)

## δ(2) is nan; so this adjusts
f(x) = isnan(δ(x)) ? float(vₜ(x+.001) - vₜ(x-.001)) : float(δ(x))
plot(0:8, f; linetype=:sticks, arrow=true, framestyle=:origin)

(Strangely, I thought defining u so it is defined at 0 might make this work, but that gives back a 0 derivative.)

1 Like