Minimizing the MSE of a cosine Fourier Series

71 Views Asked by At

When approximating an even function with period $2\pi$ by a Fourier-cosine-Series with $m$ terms, it has the error $$E_m=\int_{-\pi}^\pi \left[f(x)-\frac{a_0}{2}-\sum_{n=1}^m a_n \cos(nx)\right]^2 dx$$

Now I have to find the $a_n$'s which minimize this error. I got to the point where: $$a_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos(nx) dx$$ But I am not sure how to proceed further.

1

There are 1 best solutions below

1
On

You want to choose $a_n$ to mimimize $$E_m=\int_{-\pi}^\pi \left[f(x)-\frac{a_0}{2}-\sum_{n=1}^m a_n \cos(nx)\right]^2 dx$$ Then $$\frac{dE_m}{da_k}=0,\forall k\in \overline{0,m}$$ You can switch the order of the derivative and the integral. For $k=0$ you get $$\int_{-\pi}^\pi\frac{-1}22 \left[f(x)-\frac{a_0}{2}-\sum_{n=1}^m a_n \cos(nx)\right] dx=0$$ Notice that $$\int_{-\pi}^\pi\cos(nx)dx=0$$ With that $$\frac{a_0}2\int_{-\pi}^\pi dx=\int_{-\pi}^\pi f(x)dx$$or$$a_0=\frac 1\pi\int_{-\pi}^\pi f(x)dx$$ For all other terms you have $$-2\int_{-\pi}^\pi\cos(kx)\left[f(x)-\frac{a_0}{2}-\sum_{n=1}^m a_n \cos(nx)\right] dx=0$$ We know that $$\int_{-\pi}^\pi\cos(kx)dx=0$$ For $n\ne k$ $$\int_{-\pi}^\pi\cos(kx)\cos(nx)dx=\frac12\int_{-\pi}^\pi[\cos(k-n)x+\cos(k+n)x ]dx=0$$ and for $n=k$ $$\int_{-\pi}^\pi\cos^2(kx)dx=\frac12\int_{-\pi}^\pi[1+\cos(2kx)]dx=\pi$$ With these, you get $$a_k\pi=\int_{-\pi}^\pi f(x)\cos(kx)dx$$