Example 1 (Pulse 1)

Consider a simple undamped system y''+2y=f(t), y(0)=y'(0)=0 and its response to a square wave f(t), where f(t)=1 between 0 and 1 and 0 otherwise.


  f[t_]:=UnitStep[t]-UnitStep[t-1]
  Plot[f[t],{t,-2,3}];

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]+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,6}];

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