I am very confused on how to start this problem, would highly appreciate some help!(adsbygoogle = window.adsbygoogle || []).push({});

Consider the function

f(x)= 0, -1≤x≤0

2x, 0≤x≤1.

The Fourier series coefficients for this function are given by [a][/0]=0.5, and for k=1, 2, 3,...

[a][/k]=(2((-1)^k-1))/(k∏)^2 and[/k]=(2(-1)^(k+1))/k∏

.

Write a Matlab program to obtain three Figures:

(a) Figure 1 must contain a plot of the function f(x).

(b) Figure 2 must contain four subplots, arranged in a 2 X 2 grid. Each subplot must contain a plot of ,[g][/N](x)

one for each value of N= 1, 3, 7, 20.

(c) Figure 3 must contain a plot of f(x), and ,[g][/N](x) for N= 1, 3, 7, 20, all superimposed. Use a suitable

legend to identify the five plots in the figure.

In each case, make sure you use a suitable title, and labels for the axes. Pick at least 100 points from the interval

[-1, 10] so that you get a smooth looking plot.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Plotting the Fourier series in Matlab

**Physics Forums | Science Articles, Homework Help, Discussion**