# User:Egm4313.s12.team1.essenwein

Eric Essenwein

## Problem R6.4

### Statement

Consider the L2-ODE-CC (5) p7b-7 with the window function f(x) p.9-8 as excitation:

 ${\displaystyle \displaystyle {y''-3y'+2y=r(x)}}$ ${\displaystyle r(x)=f(x)}$ (4.0)

and the initial conditions

 ${\displaystyle \displaystyle {y(0)=1,y'(0)=0}}$ (4.1)

1. Find ${\displaystyle y_{n}(x)}$ such that:

 ${\displaystyle \displaystyle {y''_{n}+ay'_{n}+by_{n}=r_{n}(x)}}$ (4.2)

with the same initial conditions (4.1).
Plot ${\displaystyle y_{n}(x)}$ for n=2,4,8, for x in [0,10].
2.Use the matlab command ode45 to integrate the L2-ODE-CC, and plot the numerical solution to compare with the analytical solution. Level 1:n=0,1

### Part 1 Solution

First, we shift the excitation f(x) to the left by introducing a new independent variable, t. This allows the period to start at zero.

 ${\displaystyle \displaystyle t=x-{\frac {1}{4}}}$ (4.3)

The piecewise representation of the window function is now (in terms of t) as follows:

 ${\displaystyle \displaystyle f(t)=A}$ for ${\displaystyle \displaystyle t=\left[0,2\right]}$ ${\displaystyle \displaystyle f(t)=0}$ for ${\displaystyle \displaystyle t=\left[2,4\right]}$ (4.4)

To find the Fourier transform, the period of oscillation is determined:

 ${\displaystyle \displaystyle p=2L=4}$ (4.5)

And the frequency of oscillation:

 ${\displaystyle \displaystyle \omega ={\frac {2\pi }{p}}={\frac {\pi }{2}}}$ (4.6)

The general form of a Fourier transform is

 ${\displaystyle \displaystyle f(t)={{a}_{0}}+\sum \limits _{1}^{n}{\left[{{a}_{n}}\cos(n\omega t)+{{b}_{n}}\sin(n\omega t)\right]}}$ (4.7)

The following equations are given values of the constants in (4.7), evaluated for the function in (4.4):

 ${\displaystyle \displaystyle {{a}_{0}}={\frac {1}{2L}}\int \limits _{0}^{2L}{f(t)dt}={\frac {1}{4}}\int \limits _{0}^{2}{Adt}={\frac {A}{4}}(2-0)={\frac {A}{2}}}$ (4.8)

 ${\displaystyle \displaystyle {{a}_{n}}={\frac {1}{L}}\int \limits _{0}^{2L}{f(t)\cos(n\omega t)dt}={\frac {1}{2}}\int \limits _{0}^{2}{A\cos({\frac {n\pi }{2}}t)dt}={\frac {A}{n\pi }}(\sin n\pi -\sin 0)}$ (4.9)

 ${\displaystyle \displaystyle {{b}_{n}}={\frac {1}{L}}\int \limits _{0}^{2L}{f(t)\sin(n\omega t)dt}={\frac {1}{2}}\int \limits _{0}^{2}{A\sin({\frac {n\pi }{2}}t)dt}=-{\frac {A}{n\pi }}(\cos n\pi -\cos 0)={\frac {A}{n\pi }}(1-\cos n\pi )}$ (4.10)

In their simplest forms:

 ${\displaystyle \displaystyle {{a}_{n}}=0}$ (4.11)

 ${\displaystyle \displaystyle {{b}_{n}}=\left\{0,{\frac {A}{\pi }},0,{\frac {A}{2\pi }},0,{\frac {A}{3\pi }},0,{\frac {A}{4\pi }},...,0,{\frac {2A}{n\pi }}\right\}}$ (4.12)

Plugging in r(x)=f(t) in (4.0),

 ${\displaystyle \displaystyle y''-3y'+2y={\frac {1}{2}}+{\frac {2}{n\pi }}\sin({\frac {n\pi }{2}}t)}$ (4.13)

From the general form, a particular solution to (4.13) and its derivatives are as follows:

 ${\displaystyle \displaystyle {{y}_{n}}={{A}_{n}}\cos({\frac {n\pi }{2}}t)+{{B}_{n}}\sin({\frac {n\pi }{2}}t)}$ (4.14)

 ${\displaystyle \displaystyle {{y}_{n}}'=-{{A}_{n}}{\frac {n\pi }{2}}\sin({\frac {n\pi }{2}}t)+{{B}_{n}}{\frac {n\pi }{2}}\cos({\frac {n\pi }{2}}t)}$ (4.15)

 ${\displaystyle \displaystyle {{y}_{n}}''=-{{A}_{n}}{\frac {{{n}^{2}}{{\pi }^{2}}}{4}}\cos({\frac {n\pi }{2}}t)-{{B}_{n}}{\frac {{{n}^{2}}{{\pi }^{2}}}{4}}\sin({\frac {n\pi }{2}}t)}$ (4.16)

By plugging in (4.14), (4.15), and (4.16) into (4.13), we find An and Bn in terms of another constant, Cn:

 ${\displaystyle \displaystyle {{A}_{n}}=6n\pi {{C}_{n}}}$ (4.17)

 ${\displaystyle \displaystyle {{B}_{n}}=(8-{{n}^{2}}{{\pi }^{2}}){{C}_{n}}}$ (4.18)

 ${\displaystyle \displaystyle {{C}_{n}}={{\left[{\tfrac {1}{8}}n\pi ({{(8-{{n}^{2}}{{\pi }^{2}})}^{2}}+{{(6n\pi )}^{2}})\right]}^{-1}}}$ (4.19)

After substituting t with (4.3), the solutions are shown for n=2,4,8.

 ${\displaystyle \displaystyle {{y}_{2}}={{y}_{1}}+{{y}_{2}}}$ (4.20)

 ${\displaystyle \displaystyle {{y}_{4}}={{y}_{1}}+{{y}_{2}}+{{y}_{3}}+{{y}_{4}}}$ (4.21)

 ${\displaystyle \displaystyle {{y}_{8}}={{y}_{1}}+{{y}_{2}}+{{y}_{3}}+{{y}_{4}}+{{y}_{5}}+{{y}_{6}}+{{y}_{7}}+{{y}_{8}}}$ (4.22)

### Part 2 Solution

The excitation for n=0 and n=1 are the same, because ${\displaystyle a_{1}=b_{1}=0}$.

The homogeneous solution to (4.0) is

 ${\displaystyle \displaystyle {{y}_{h}}={{C}_{1}}{{\operatorname {e} }^{2t}}+{{C}_{2}}{{\operatorname {e} }^{t}}}$ (4.23)

For ${\displaystyle r(x)=a_{0}}$, the particular solution is

 ${\displaystyle \displaystyle {{y}_{p}}={{C}_{3}}}$ (4.24)

Evaluating, we find that

 ${\displaystyle {{C}_{1}}=-{\tfrac {3}{4}}}$ ${\displaystyle {{C}_{2}}={\tfrac {3}{2}}}$ ${\displaystyle {{C}_{3}}={\tfrac {1}{4}}}$ (4.25)

Thus, the complete solution ${\displaystyle y_{0}}$ is

 ${\displaystyle {{y}_{0}}={\tfrac {1}{4}}-{\tfrac {3}{4}}{{\operatorname {e} }^{2(x-{\tfrac {1}{4}})}}+{\tfrac {3}{2}}{{\operatorname {e} }^{x-{\tfrac {1}{4}}}}}$ (4.26)

Integrating ${\displaystyle y_{0}}$ using MATLAB's ode45 command, the following plot is obtained for y:

### Author

Solved and Typed By -
Reviewed By -

## Problem R5.6

### Statement

Consider the following L2-ODE-CC; see p.6-6:

 ${\displaystyle \displaystyle {y}''-4{y}'+13{y}=2e^{-2x}\cos(3x)}$ (6.0)

Homogeneous solution:

 ${\displaystyle \displaystyle {y}_{h}(x)=e^{-2x}[A\cos 3x+B\sin 3x]}$ (6.1)

Particular solution:

 ${\displaystyle \displaystyle {y}_{p}(x)=xe^{-2x}[M\cos 3x+N\sin 3x]}$ (6.2)

Complete the solution for this problem.

Find the overall solution ${\displaystyle y(x)}$ that corresponds to the initial condition (3b) p.3-7

 ${\displaystyle \displaystyle y(0)=1,y'(0)=0}$ (6.3)

### Solution

Start by finding ${\displaystyle y_{p}'}$ and ${\displaystyle y_{p}''}$.

 ${\displaystyle \displaystyle {y}_{p}'={{e}^{-2x}}[(-3Mx-2Nx+N)\sin 3x+(-2Mx+3Nx+M)\cos 3x]}$ (6.4)
 ${\displaystyle \displaystyle {y}_{p}''={{e}^{-2x}}[(12Mx-6M-5Nx-4N)\sin 3x+(-15Mx-12M-12Nx+6N)\cos 3x]}$ (6.5)

Substitute ${\displaystyle y_{p}}$ and its derivatives into (6.0) to find ${\displaystyle M}$ and ${\displaystyle N}$.

 ${\displaystyle \displaystyle {y}_{p}''+4{y}_{p}'+13{y}_{p}={{e}^{-2x}}[(-6M)\sin 3x+(-10Mx-8M+6N)\cos 3x]}$ (6.6)

Separating terms and setting equal to the excitation from (6.0):

 ${\displaystyle \displaystyle -6M{{e}^{-2x}}\sin 3x+(-8M+6N){{e}^{-2x}}\cos 3x-10Mx{{e}^{-2x}}\cos 3x=2{{e}^{-2x}}\cos 3x}$ (6.7)

From (6.7), we solve coefficients to get

 ${\displaystyle \displaystyle -6M=0}$ ${\displaystyle \displaystyle -8M+6N=2}$ ${\displaystyle \displaystyle -10M=0}$ (6.8)

Solving for ${\displaystyle M}$ and ${\displaystyle N}$:

 ${\displaystyle \displaystyle M=0}$ ${\displaystyle \displaystyle N={\frac {1}{3}}}$ (6.9)

Which gives us the particular solution:

 ${\displaystyle \displaystyle {y}_{p}={\frac {1}{3}}x{{e}^{-2x}}\sin 3x}$ (6.10)

For the general solution,

 ${\displaystyle \displaystyle y={{y}_{h}}+{{y}_{p}}}$ (6.11)
 ${\displaystyle \displaystyle y=e^{-2x}[A\cos 3x+B\sin 3x]+{\frac {1}{3}}x{{e}^{-2x}}\sin 3x}$ (6.12)
 ${\displaystyle \displaystyle y=e^{-2x}[A\cos 3x+(B+{\frac {1}{3}}x)\sin 3x]}$ (6.13)

To solve for ${\displaystyle A}$ and ${\displaystyle B}$, we use initial conditions from (6.3):

 ${\displaystyle \displaystyle y(0)=e^{-2(0)}[A\cos 3(0)+(B+{\frac {1}{3}}(0))\sin 3(0)]=1}$ (6.14)

Which simplifies to:

 ${\displaystyle \displaystyle A=1}$ (6.15)

For the second initial condition from (6.3):

 ${\displaystyle \displaystyle y'={{e}^{-2x}}[(-3A-2B+{\frac {1}{3}}+{\frac {2}{3}}x)\sin 3x+(3B+x-2)\cos 3x]}$ (6.16)
 ${\displaystyle \displaystyle y'(0)={{e}^{-2(0)}}[(-3A-2B+{\frac {1}{3}}+{\frac {2}{3}}(0))\sin 3(0)+(3B+(0)-2)\cos 3(0)]=0}$ (6.17)
 ${\displaystyle \displaystyle 3B-2=0}$ (6.18)
 ${\displaystyle \displaystyle B={\frac {2}{3}}}$ (6.19)

We can now write ${\displaystyle y}$ with all coefficients known.

 ${\displaystyle \displaystyle y={{e}^{-2x}}[(1)\cos 3x+({\frac {2}{3}}+{\frac {1}{3}}x)\sin 3x]}$ (6.20)

Final Equation

 ${\displaystyle \displaystyle y={{e}^{-2x}}[\cos 3x+({\frac {2}{3}}+{\frac {1}{3}}x)\sin 3x]}$ (6.21)

### Author

Solved and Typed By - Egm4313.s12.team1.essenwein (talk) 23:45, 19 March 2012 (UTC)
Reviewed By -