Example 3 (Delta Function)

Next consider a simple damped system y''+3y'+2y=f(t), y(0)=y'(0)=0 and its response to a delta function at 1.

In[73]:=

  Clear[f]
  f[t_]:=DiracDelta[t-1]

In[74]:=

  Clear[de,tde,newtde,Y,y]

Here's the differential equation:

In[75]:=

  de=y''[t]+3 y'[t]+2 y[t]==f[t]

Out[75]=

  2 y[t] + 3 y'[t] + y''[t] == DiracDelta[-1 + t]

Here is the transformed differential equation:

In[76]:=

  tde=LaplaceTransform[de,t,s]

Out[76]=

                                    2
  2 LaplaceTransform[y[t], t, s] + s  LaplaceTransform[y[t], t, s] + 
   
                                                                    -s
     3 (s LaplaceTransform[y[t], t, s] - y[0]) - s y[0] - y'[0] == E

Let's make use of the initial values:

In[77]:=

  newtde=tde/.{y[0]->0,y'[0]->0}

Out[77]=

  2 LaplaceTransform[y[t], t, s] + 3 s LaplaceTransform[y[t], t, s] + 
   
      2                                  -s
     s  LaplaceTransform[y[t], t, s] == E

Now solve this equation for Y[s].

In[78]:=

  Solve[newtde,LaplaceTransform[y[t],t,s]];
  Y[s_]:=Evaluate[LaplaceTransform[y[t],t,s]/.Flatten[%]]
  Y[s]

Out[78]=

          1
  -----------------
   s             2
  E  (2 + 3 s + s )

In[79]:=

  y[t_]:=InverseLaplaceTransform[Y[s],s,t]
  y[t]

Out[79]=

     2 - 2 t    1 - t
  (-E        + E     ) UnitStep[-1 + t]

In[80]:=

  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