1

I have the given function

\begin{equation} f(t)=\begin{cases} 2, \ \ \ \ -2\le t<-1 \\ 1, \ \ \ \ -1\le t<0 \\ 2, \ \ \ \ 0\le t<1 \\ 3, \ \ \ \ 1\le t\le2 \end{cases} \end{equation}

and I want to generate the Fourier coefficients of it. I consider each indicator function at a time and get:

First indicator function, $A_1: f_1(t)= 2 \ \ \ \ \ -2\le x\le -1$: $$ \alpha_0=\int_{-2}^{-1}2dt=2\big[t\big]_{-2}^{-1}=2\\ \alpha_k=2\int_{-2}^{-1}2\cos{\omega k t}dt=\frac{8}{\pi k}\left[\sin\frac{\pi}{2} k t\right]_{-2}^{-1}=-\frac{8}{\pi k}\left[\sin \frac{\pi}{2} k\right]\\ \beta_k=2\int_{-2}^{-1}2\sin\omega kt dt=-\frac{8}{\pi k}\left[\cos\frac{\pi}{2} k t\right]_{-2}^{-1}=\frac{8}{\pi k}\left[(-1)^k -\cos \frac{\pi}{2} k \right] $$

Then I insert these in the Fourier series formula and get ie. for the first indicator function:

$$f_1(t)= 2+\sum_{k=1}^n\left(-\frac{8}{\pi k}\left[\sin \frac{\pi}{2} k\right]\right)\cos\frac{k\pi}{2}t +\left(\frac{8}{\pi k}\left[(-1)^k -\cos \frac{\pi}{2} k \right]\right)\sin\frac{k\pi}{2}t$$

and then I repeat this for the other indicator functions on each interval

$f_2(t)= 1 \ \ \ \ \ -1\le x\le 0 \\$ $$\alpha_0=\int_{-1}^{0}\text{d}t=1\\ \alpha_k=2\int_{-1}^{0}\cos{\omega k t}dt=\frac{4}{\pi k}\left[\sin\frac{\pi}{2} k t\right]_{-1}^{0}=-\frac{4}{\pi k}\left[\sin \frac{\pi}{2} k\right]\\ \beta_k=2\int_{-1}^{0}\sin\omega kt dt=-\frac{4}{\pi k}\left[\cos\frac{\pi}{2} k t\right]_{-1}^{0}=\frac{4}{\pi k}\left[\cos \frac{\pi}{2} k -1\right] $$

Then on $ f_3(t)= 2 \ \ \ \ \ 0\le x\le 1$

$$\alpha_0=\int_{0}^{1}2\text{d}t=2\\ \alpha_k=2\int_{0}^{1}2\cos{\omega k t}dt=\frac{8}{\pi k}\left[\sin\frac{\pi}{2} k t\right]_{0}^{1}=\frac{8}{\pi k}\left[\sin \frac{\pi}{2} k\right]\\ \beta_k=2\int_{0}^{1}2\sin\omega kt \text{d}t=-\frac{8}{\pi k}\left[\cos\frac{\pi}{2} k t\right]_{0}^{1}=\frac{8}{\pi k}\left[1-\cos \frac{\pi}{2} k\right]$$

and so on...

Then at the end, I sum these all up together, and get the total Fourier series for $f(t)$.

But it turns out not to be correct, I have checked and it should be correct. My question is : Is the PROCEDURE correct?

Or is there a problem with the $\omega$ or $L$ in the Fourier series formula?

According to the Fourier series literature, this should be correct procedure: you take each interval and generate the coefficients of it, then you generate the series using the Fourier series formula, and finally you add all the indicator function Fourier series together.

Luthier415Hz
  • 2,739
  • 6
  • 22
  • 3
    $$\alpha_0=\color{red}{\frac{1}{2L}}\int_{-L}^L f(t),dt\ ,\ \rm{etc}$$ – David Apr 21 '23 at 11:49
  • 3
    A fourier series is a representation of a periodic function. Your function has no period. Let us suppose it is T=4, since t ranges from -2 to +2. Really what you should do is then put the whole function into the integrals for $\alpha_0$ etc and integrate from -2 to +2. If you want to do it piece by piece as you have done you will need to use $$\begin{equation} f_1(t)=\begin{cases} 2, \ \ \ \ -2\le t<-1 \ 0, \ \ \ \ -1\le t<2
    \end{cases}
    

    \end{equation}$$ and similarly for your other pieces, so that you maintain T = 4.

    – Paul Apr 21 '23 at 11:51
  • Thanks Paul. How do you put the whole function into the integrals? Can you show an example? – Luthier415Hz Apr 21 '23 at 11:52
  • 1
    $\int_{-2}^{-2}f(t)dt=\int_{-2}^{-1}2dt+\int_{-1}^{0}1dt+\int_{0}^{1}2dt+\int_{1}^{2}3dt$ – Paul Apr 21 '23 at 11:57
  • Thanks Paul, does this principle apply also on a case of non-uniform grid? PS: There is a -2 in the upper limit of the left integral – Luthier415Hz Apr 21 '23 at 11:59
  • 1
    you need a definition of f(t) over one time period, which may be a single formula or piecewise linear as here, or perhaps some none linear piecewise definition. It doesn't matter that the intervals here are the same length, any integral can be broken up into integrals over disjoint intervals – Paul Apr 21 '23 at 12:02
  • Thanks, I will re-do this. – Luthier415Hz Apr 21 '23 at 12:03

0 Answers0