Calculating Fourier coefficient of a split function with time period $y\left(x\right)=\begin{cases}-1&-T<x\le 0\\ 1&0<x\le T\end{cases}$

32 Views Asked by At

$$y\left(x\right)=\begin{cases}-1&-T<x\le 0\\ 1&0<x\le T\end{cases}$$ I tried to use definition:
$B_k=\frac{1}{2T}\int _{-T}^{+T}y\left(x\right)e^{-jk\omega _0x}dx\:\:=\frac{1}{2T}\int _{-T}^0\left(-1\right)\cdot e^{-jk\omega _0x}dx\:+\frac{1}{2T}\int _0^T\left(1\right)\cdot e^{-jk\omega _0x}dx\:\:$
We know that $\omega _0=\frac{2\pi }{2T}$ and thus:
$B_k=\frac{1}{jk\pi }\left(1-\left[-1\right]^k\right)$ Which means $B_k$ is $0$ for even and not $0$ for odd. But according to answers:
They Reached this:
$$B_k{\:=\:\begin{cases}-\frac{2j}{\pi k}&k\:odd\\ 0&k\:even\end{cases}}$$ But no idea how to reach this. Where is my calculation wrong?

EDIT: Appearntly I did not know that if I say $k=ODD$, so I can "react" to the k as like a odd one and just multiply by 2 the $B_k$ I got.
That was my mistake, now learned.