Example 2 (Pulse 2)
Clear[f]
f[t_]:=UnitStep[t]-UnitStep[t-1]
Plot[f[t],{t,-2,3}];Again, you will have to get comfortable with modeling using pulses and Heaviside functions!
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.
Up to Solving Constant Coefficient Initial Value Problems with Special Forcing Functions