# 一般周期的傅里叶级数

1，假设 $$f(x)$$ 是周期为 $$2l$$ 的函数，满足傅里级数收敛的条件。则它的傅里叶级数为

\begin{align*}f(x)&=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n\cos\frac{n\pi x}{l}+b_n\sin\frac{n\pi x}{l}\\ &a_0=\frac{1}{l}\int_{-l}^{l}f(x)dx\\ &a_n=\frac{1}{l}\int_{-l}^{l}f(x)\cos\frac{n\pi x}{l}dx\\ &b_n=\frac{1}{l}\int_{-l}^{l}f(x)\sin\frac{n\pi x}{l}dx\end{align*}

2，推导过程：令 $$z=\frac{\pi x}{l}$$，则 $$-l\le x\le l$$ 变成 $$-\pi\le z\le \pi$$，所以

$f(x)=f(\frac{lz}{\pi})=F(z)$

$F(z)=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n\cos nz+b_n\sin nz$

\begin{align*}a_0&=\frac{1}{\pi}\int_{-\pi}^{\pi}F(z)dz\\ a_n&=\frac{1}{\pi}\int_{-\pi}^{\pi}F(z)\cos nzdz\\ b_n&=\frac{1}{\pi}\int_{-\pi}^{\pi}F(z)\sin nzdz\end{align*}

\begin{align*}a_0&=\frac{1}{l}\int_{-l}^{l}f(x)dx\\ a_n&=\frac{1}{l}\int_{-l}^{l}f(x)\cos \frac{n\pi x}{l}dx\\ b_n&=\frac{1}{l}\int_{-l}^{l}f(x)\sin \frac{n\pi x}{l}dx\end{align*}

\begin{align*}a_0&=\frac{1}{2}\int_{-2}^{2}f(x)dx=\frac{1}{2}\int_{-2}^{2}hdx=\frac{hx}{2}\Big|_{0}^{2}=h\end{align*}

\begin{align*}a_n&=\frac{1}{2}\int_{-2}^{2}f(x)\cos\frac{n\pi x}{2}dx\\ &=\frac{1}{2}\int_{0}^{2}h\cos\frac{n\pi x}{2}dx\\ &=\frac{h}{2}\cdot\frac{2}{n\pi}\sin\frac{n\pi x}{2}\Big|_0^2\\ &=0\end{align*}

\begin{align*}b_n&=\frac{1}{2}\int_{-2}^{2}f(x)\sin\frac{n\pi x}{2}dx\\ &=\frac{1}{2}\int_{0}^{2}h\sin\frac{n\pi x}{2}dx\\ &=-\frac{h}{2}\cdot\frac{2}{n\pi}\cos\frac{n\pi x}{2}\Big|_0^2\\ &=\frac{h}{n\pi}(1-(-1)^n)\end{align*}

$f(x)=h+\sum_{n=1}^{\infty}\frac{h}{n\pi}(1-(-1)^n)\sin \frac{n\pi x}{2}$