Example for forcing function with Dirac deltas
Solve the initial value problem
f = 2*dirac(t-1)-3*dirac(t-2)
f = 
Matlab plots dirac(t) as a zero function, so we don't need to plot the function f.
F = laplace(f)
F = 
Sol = solve(Y2+3*Y1+2*Y==F,Y)
Sol =

partfrac(1/(s^2+3*s+2))
ans =

sol = ilaplace(Sol)
sol = 
fplot(sol,[0 6]); xlabel('t'); title('solution y(t)'); ax_origin
We can see that at
the function
has a jump of 2, and at
the function
has a jump of
. fplot(diff(sol),[0 6]); xlabel('t'); title('derivative y''(t)'); ax_origin
simplify( diff(sol) )
ans = 
Draw the x and y axes through the origin:
set(gca,'XAxisLoc','origin','YAxisLoc','origin'); box off