Step/Impulse function setup confusion

I have a final coming up next week (Tuesday) and a sample question for the test is the following.

I was wondering if I have properly set it up for solving with Laplace as I haven't encountered a question with two level changes before and it's confussed me.

First line is the question and the second line is my questionable setup.

My understanding is that I'm doing this...

level+(newLevel-oldLevel)U(t-PointOfChange)

Finding good examples of Step & Impulse online has proven to be a greater challenge than I thought it would be.

-
I'm not sure what you mean by levels, but if apply the Laplace transform to the right hand side you just get $$\int_\pi^{2\pi} e^{-st}dt,$$ which can be evaluated explicitly, right? –  anon Jun 16 '12 at 18:23
It's a graph of 'something' over time. That 'something' could be voltage level or switch on/off indication. So the level could be 0mV/100mV or 0/1. –  Chef Flambe Jun 16 '12 at 20:40
Do you mean $y''+y=f(t)$ since you gave two initial conditions? –  JohnD Dec 21 '12 at 15:46

Since you specified two initial conditions, I will assume you meant to solve $$y''+y=f(t)=\begin{cases}0, &0<t<\pi,\\ 1, &\pi<t<2\pi,\\ 0, &t>2\pi.\end{cases}$$

In preparation for Laplace transforming both sides of the equation, let's look at how to compute $\mathscr{L}\{f(t)\}$. One way is directly from the definition: $$\mathscr{L}\{f(t)\}=\int_0^\infty f(t)e^{-st}\,dt=\int_{\pi}^{2\pi} 1\cdot e^{-st}\,dt={1\over s}\left(e^{-\pi s}-e^{-2\pi s}\right).$$ However, it sounds like you are curious about how to compute the transform after rewriting $f(t)$ as a combination of unit step functions. Here's how (and this might help to see how to get this form): \begin{align} f(t)&=u(t-\pi)-u(t-2\pi)\\ \mathscr{L}\{f(t)\}&=\mathscr{L}\{u(t-\pi)\}-\mathscr{L}\{u(t-2\pi)\}={e^{-\pi s}\over s}-{e^{-2\pi s}\over s}, \end{align} which is of course the same result as the previous method.

Now we are ready. Laplace transforming both sides, \begin{align} \mathscr{L}\left\{y''+y\right\}&=\mathscr{L}\{f(t)\}\\ s^2Y(s)-sy(0)-y'(0)+Y(s)&={1\over s}\left(e^{-\pi s}-e^{-2\pi s}\right)\\ Y(s)&={e^{-\pi s}-e^{-2\pi s}\over s(s^2+1)}\\ Y(s)&={e^{-\pi s}\over s}\cdot {1\over s^2+1}-{e^{-2\pi s}\over s}\cdot {1\over s^2+1} \end{align}

In this form, the inverse transforms on the right-hand side are readily doable via the Convolution Theorem:

\begin{align} \mathscr{L}^{-1}\{Y(s)\}&=\mathscr{L}^{-1}\left\{{e^{-\pi s}\over s}\cdot {1\over s^2+1}-{e^{-2\pi s}\over s}\cdot {1\over s^2+1}\right\}\\ y(t)&=u(t-\pi)*\sin t-u(t-2\pi)*\sin t\\ y(t)&=\int_0^t u(\tau-\pi)\sin(t-\tau)\,d\tau -\int_0^t u(\tau-2\pi)\sin(t-\tau)\,d\tau\\ y(t)&=(1+\cos t)u(t-\pi)-(1-\cos t)u(t-2\pi). \end{align}

Here's a plot of the input $f(t)$ (red) and the system response $y(t)$ (blue):

Hope that helps.

-