Fourier coefficients of a square wave

181 Views Asked by At

$x(t)$ is continuous-time periodic signal with period T and $T_1 < T$ (for example maybe $T = 4T_1$)

$x(t)=\left\{\begin{array}{ll} M & 0 \leq t \leq T_{1} \\ 0 & T_{1} < t < T \end{array}\right.$

$x(t)$ can be represented as trigonometric Fourier series like:

$x(t)=\frac{A_{0}}{2}+\sum_{k=1}^{\infty}\left(A_{k} \cos k w_{0} t+B_{k} \sin k w_{0} t\right)$

I want to find and plot the coefficients, $A_{0}, A_{k}, B_{k}$.

my solution steps:

I used the formulas

$\begin{aligned} a_{0} & = \frac{A_0}{2} = \frac{1}{T} \int_{0}^{T} x(t) d t=\frac{1}{T}\left[\int_{0}^{T_{1}} M d t\right]=\frac{M T_{1}}{T} \\ A_0 & = \frac{2 M T_{1}}{T} \\ \\ A_{k} & = \frac{2}{T} \int_{0}^{T} x(t) \cos \left(k \omega_{0} t\right) d t \\ & = \frac{2}{T} \int_{0}^{T_{1}} M \cos \left(k \omega_{0} t\right) d t =\frac{2 M}{k \omega_{0} T}\left(\sin \left(k \omega_{0} t\right)\right) \Big|_{0}^{T_1} \\ A_{k} & = \frac{M}{k \pi} \sin \left(k w_{0} T_{1}\right) \\ \\ B_{k} & = \frac{2}{T} \int_{0}^{T} x(t) \sin \left(b w_{0} t\right) d t \\ B_{k} & = -\frac{M}{k \pi}\left(\cos \left(k w_{0} T_{1}\right) - 1 \right) \end{aligned}$

However, I am not sure that I solve these correctly. Because I could not find how can I plot $A_{k}$ and $B_{k}$ in these forms. Should I assume values for $T$ (in terms of $T_{1}$, e.g. $T=4$, ) and $M$. Could you show way how can I find these trigonometric coefficients if I am wrong? Can I do further simplification for my result $A_k$ and $B_k$. If possible how can I simplify?

Edit:

Also I tried different way such that: $$\begin{aligned} c_{k} & = \frac{1}{T} \int_{0}^{T} x(t) e^{-j k \omega_{0} t} d t \\ &=\frac{1}{T}\left[\int_{0}^{T_{1}} M \cdot e^{-j k w_{0} t} d t\right] \\ & = -\frac{M}{j^{t} \omega_{0} T}\left[e^{-j k \omega_{0} T_{1}}-1\right] \\ & = \frac{M}{k \pi} \cdot \frac{1}{2 j} \cdot\left[1-e^{-j k \omega_{0} T_{1}}\right] \\ & = \frac{M}{k \pi} \cdot e^{-j k \omega_{0} \frac{T_{1}}{2}} \cdot \sin \left(k \omega_{0} \frac{T_{1}}{2}\right) \end{aligned}$$

But again this $c_k$ looks like very different from my desired coefficients. Is it possible to express $A_k$ and $B_k$ in terms of $c_k$ ?