Sample Laplace Transform Problem

(Boyce-DiPrima section 6.4, #1)

syms s t Y
eqn = sym('D(D(y))(t) + y(t) = heaviside(t) - heaviside(t - pi/2)');
lteqn = laplace(eqn, t, s);
neweqn = subs(lteqn, {'laplace(y(t),t,s)', 'y(0)', 'D(y)(0)'}, ...
     {Y, 0, 1});
ytrans = solve(neweqn, Y)
y = ilaplace(ytrans, s, t)
ezplot(y, [0, 2*pi])
 
ytrans =
 
(s+1-exp(-1/2*s*pi))/s/(1+s^2)
 
 
 
y =
 
(-1+sin(t))*heaviside(t-1/2*pi)+sin(t)+1-cos(t)
 
 

Note that for t > pi/2, the solution is a solution of the homogeneous equation, or in other words, a linear combination of sines and cosines. The solution for y is also continuous in t. For 0 < t < pi/2, we see transient behavior.