The Fourier series of a $2T-$periodic rectangular wave

calculusfourier analysisfourier series

I am working on the following exercise:

Find the Fourier series of the $2T-$periodic (modified) rectangular wave function $0<\tau<2T$
$$f(x) = f(\tau, x) = \left\{\begin{array}{lr}
1, & \text{for } 0\leq x\leq \tau\\
0, & \text{for } \tau\leq x\leq 2T
\end{array}\right\}. $$

What can you say about the convergence behaviour? Additionally compute the Distortion Ratio $$D =\sqrt{\frac{\sum_{n \ge 2} c_n^2}{\sum_{n \ge 1} c_n^2}}$$
where $c_n^2 = a_n^2+b_n^2$ as definded for the Fourier Series below.

The Fourier series is defined as: $$ \frac{a_0}{2} + \sum_{n=1}^\infty a_n cos(nx) + b_nsin(nx) \ dx$$

I calculated the coefficients for the Fourier Series as follows:

For $2T-$peridoic functions we have $$a_n = \frac{1}{T}\int_{-T}^Tf(x) cos(\frac{n \pi x}{T}) \ dt $$
for $n = 0,1,2, \ldots$ .

And $$b_n = \frac{1}{T} \int_{-T}^T f(x) sin(\frac{n \pi x}{T}) \ dt $$
for $n = 1,2,3 \ldots$ .

Since $f$ is a rectangular wave it suffices to use $T$ and $0$ as integration limits and so I found that $a_0 = 1$ and for $n>0$:
$$a_n = \frac{sin(\frac{\pi n x}{T})}{ \pi n}$$
and
$$b_n = -\frac{cos(\pi n)-1}{ \pi n} = -\frac{(-1)^n-1}{ \pi n}.$$

I do not know what we can say about the convergence behaviour of this series. I also do not know how we could calculate $D$ in an intelligent way. Could you help me?

Best Answer

Allow me to change some variables in order to clarify things a little better...

According to the definition of your signal:

$$f(t) = f(\tau, t) = \left\{\begin{array}{lr} 1, & \text{for } 0\leq t\leq \tau\\ 0, & \text{for } \tau\leq t\leq 2T \end{array}\right\}$$

As you stated, this is a modified $2T$-periodic square wave. Basically, by changing the parameter $\tau$, you define the duty cycle of the square wave, which will directly affect the average value (DC component of the Fourier Series) of your signal, as well as the coefficients for its harmonics.

Therefore, your Fourier series must (and in fact will) be parameterized by $\tau$:

$$ f(\tau, t)=c_{0}(\tau) + \sum_{n=1}^\infty a_n(\tau) \cos(n\omega_0t) + \sum_{n=1}^\infty b_n(\tau) \sin(n\omega_0t)$$

Where:

\begin{align} c_{0}(\tau)&=\frac{1}{T_0}\int_{T_0}f(\tau,t)dt\\ a_{n}(\tau)&=\frac{2}{T_0}\int_{T_0}f(\tau,t)\cos(n\omega_0t)dt\\ b_{n}(\tau)&=\frac{2}{T_0}\int_{T_0}f(\tau,t)\sin(n\omega_0t)dt\\ \end{align}

Where for the case of your signal:

$$T_0=2T \qquad \omega_0=\frac{2\pi}{2T}=\frac{\pi}{T}$$

We can calculate the average value as:

\begin{align} c_{0}(\tau)&=\frac{1}{T_0}\int_{T_0}f(\tau,t)dt\\ &=\frac{1}{2T}\left[\int_{0}^{\tau}f(\tau,t)dt+\int_{\tau}^{2T}f(\tau,t)dt\right]\\ &=\frac{1}{2T}\int_{0}^{\tau}dt\\ &=\frac{\tau}{2T} \end{align}

The same goes for the harmonic coefficients:

\begin{align} a_{n}(\tau)&=\frac{2}{T_0}\int_{T_0}f(\tau,t)\cos(n\omega_0t)dt\\ &=\frac{1}{T}\left[\int_{0}^{\tau}f(\tau,t)\cos(n\omega_0t)dt+\int_{\tau}^{2T}f(\tau,t)\cos(n\omega_0t)dt\right]\\ &=\frac{1}{T}\int_{0}^{\tau}\cos(n\omega_0t)dt\\ &=\frac{1}{Tn\omega_0}\sin(n\omega_0\tau)\\ &=\frac{1}{n\pi}\sin\left(\frac{n\pi}{T}\tau\right) \end{align}

\begin{align} b_{n}(\tau)&=\frac{2}{T_0}\int_{T_0}f(\tau,t)\sin(n\omega_0t)dt\\ &=\frac{1}{T}\left[\int_{0}^{\tau}f(\tau,t)\sin(n\omega_0t)dt+\int_{\tau}^{2T}f(\tau,t)\sin(n\omega_0t)dt\right]\\ &=\frac{1}{T}\int_{0}^{\tau}\sin(n\omega_0t)dt\\ &=-\frac{1}{Tn\omega_0}\left[\cos(n\omega_0\tau)-1\right]\\ &=\frac{1}{n\pi}\left[1-\cos\left(\frac{n\pi}{T}\tau\right)\right] \end{align}

Therefore, a final, more clean version of the Fourier series representation of your signal would be:

$$f(\tau,t)=\frac{\tau}{2T}+\frac{1}{\pi}\sum_{n=1}^\infty\frac{1}{n}\left[\sin\left(\frac{n\pi}{T}(\tau-t)\right)+\sin\left(\frac{n\pi}{T}t\right)\right]$$

As per the convergence, your original time-domain signal is periodic piece-wise continuous with piece-wise continuous first derivatives. Then, according to Dirichlet's convergence theorem (1824), the Fourier series converges to the function point-wise:

$$\frac{f(\tau,t_{+})+f(\tau,t_{-})}{2}$$

That is the average value of the one-sided limits of the function at any $t$.

Further investigation may lead us into stronger conclusions such as $L^2$ or uniform convergence...

It seems to me that the THD will be naturally a function of $\tau$, as it will influence the amplitude of your harmonics, as can be seen when we calculate $c_{n}^{2}=a_{n}^{2}+b_{n}^{2}$:

\begin{align} c_{n}^{2}&=a_{n}^{2}+b_{n}^{2}\\ &=\frac{1}{\left(n\pi\right)^2}\left[\sin^2\left(\frac{n\pi}{T}\tau\right)+\cos^2\left(\frac{n\pi}{T}\tau\right)-2\cos\left(\frac{n\pi}{T}\tau\right)+1\right]\\ &=\frac{1}{\left(n\pi\right)^2}\left[2-2\cos\left(\frac{n\pi}{T}\tau\right)\right]\\ &=\frac{4}{\left(n\pi\right)^2}\sin^2\left(\frac{n\pi}{2T}\tau\right) \end{align}

Then, the THD can be rewritten as:

$$D(\tau)=\sqrt{\frac{\sum_{n=2}^{\infty}\frac{1}{n^2}\sin^2\left(\frac{n\pi}{2T}\tau\right)}{\sum_{n=1}^{\infty}\frac{1}{n^2}\sin^2\left(\frac{n\pi}{2T}\tau\right)}}=\sqrt{\frac{\sum_{n=2}^{\infty}\frac{1}{n^2}\sin^2\left(\frac{n\pi}{2T}\tau\right)}{\sin^2\left(\frac{\pi}{2T}\tau\right)+\sum_{n=2}^{\infty}\frac{1}{n^2}\sin^2\left(\frac{n\pi}{2T}\tau\right)}}$$

Related Question