Question

C/C++

This is homework problem for Section 12.2 Exercise 3 (for 6th version textbook, Page 681).

Suppose for the following function

f(x)=\left\{\begin{array}{lc} 1, & -1<x<0 \\ x, & 0 \leq x<1 \end{array}\right.

you have expanded in a Fourier series:

f(x)=\frac{3}{4}+\sum_{n=1}^{\infty}\left[\frac{(-1)^{n}-1}{n^{2} \pi^{2}} \cos n \pi x-\frac{1}{n \pi} \sin n \pi x\right]

Using MATLAB, plot the periodic extensions of the function f(x) in the Fourier series in the x range from -3 to 3 for

1) n goes to 0 (the first term that is outside the )

2) n goes to 1

3) n goes to 2

4) n goes to 3

5) n goes to 100

Verified