Example 3 (Delta Function)
Clear[f] f[t_]:=DiracDelta[t-1]
Clear[de,tde,newtde,Y,y]
Here's the differential equation:
de=y''[t]+3 y'[t]+2 y[t]==f[t]
Here is the transformed differential equation:
tde=LaplaceTransform[de,t,s]
Let's make use of the initial values:
newtde=tde/.{y[0]->0,y'[0]->0}Now solve this equation for Y[s].
Solve[newtde,LaplaceTransform[y[t],t,s]]; Y[s_]:=Evaluate[LaplaceTransform[y[t],t,s]/.Flatten[%]] Y[s]
y[t_]:=InverseLaplaceTransform[Y[s],s,t] y[t]
Plot[Evaluate[y[t]],{t,0,3}];Remember, the Evaluate[ ] command is to allow Mathematica to do a complicated plot more quickly. Notice that the output here is much steeper at the beginning than it was with a square pulse input.
Up to Solving Constant Coefficient Initial Value Problems with Special Forcing Functions