Having trouble with undefined terms in a Fourier series

577 Views Asked by At

So...I am trying to find the Fourier series for the following function:

$ f(t)= \begin{cases} 0&\text{if}\, -\pi\leq t\lt -\pi/2\\ \cos(t)&\text{if}\, -\pi/2\leq t\leq \pi/2\\ 0&\text{if}\, \pi/2\lt t\leq \pi\\ \end{cases} $

Where its period,$T$, is $2\pi$ and thus $w=2\pi/T=1$

When I try to find out the terms, I have the following:

$a[0]=\int^{\pi/2}_{-\pi/2}cos(t)dt=2$

$a[n]=\int^{\pi/2}_{-\pi/2}cos(t)cos(nwt)dt=\int^{\pi/2}_{-\pi/2}cos(t)cos(nt)dt=-\frac{(2cos((\frac{\pi n}{2}))}{(n^2-1)}$

$b[n]=\int^{\pi/2}_{-\pi/2}cos(t)sin(nwt)dt=\int^{\pi/2}_{-\pi/2}cos(t)sin(nt)dt=0$ (even function)

Where the weirdness starts... If I evaluate some terms, it's noticeable that the $n=1$ term is not defined. Is that even possible, or did I make a mistake?

2

There are 2 best solutions below

0
On BEST ANSWER

Hint

If the general term is not define for some $n$ , then you can separately calculate the term. Suppose it is mentioned in question, is at $n=1$ the coefficient is not defined so you have to substitute $n=1$ in the formula of $a_n$ So if you put $n=1$ in the formula for $a_n$ then it appears as $$a_1 = \frac{1} {\pi} \int_{-\pi}^{\pi} f(x)\cos{{x} } $$ Now you can substitue the value of $f(x)$ and calculate $a_1$ Where $ L = \pi $ (half of the period)

2
On

$$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}cos(t)cos(nt) dt = \frac12\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\bigl(cos((1-n) t) + cos((1+n) t)\bigr)dt$$ Here is the problem. You can't integrate the expression now because the argument of the first cosine might be zero. So you now have to divide it to two cases: $n=1$ and $n>1$.

First case: $$\frac12\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\bigl(1 + cos((1+n) t)\bigr)dt = \frac12\bigl[t+\frac{1}{1+n}sin((1+n)t)\bigr]_{-\frac{\pi}{2}}^{\frac{\pi}{2}}$$

Second case: $$\frac12\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\bigl(cos((n-1) t) + cos((1+n) t)\bigr)dt = \frac12\bigl[\frac{1}{n-1}sin((n-1)t)+\frac{1}{1+n}sin((1+n)t)\bigr]_{-\frac{\pi}{2}}^{\frac{\pi}{2}}$$

Now it leads to straightforward calculation. All needed terms are now defined.

By the way, you shoud divide $a_0$ by $2\pi$.

EDIT: You need to divide $a_0$ by $2\pi$ and all other coefficients by $\pi$.