Graphing partial sums of harmonic fourier series

11 views (last 30 days)
Hi,everyone. So I have calculated by hand the sine and cousine fourier series in summation form. I was asked to plot the partial sum up to the fifth harmonic of the fourier cosine representation for x=-2 to 4 but I am ensure of how to do it. The cut off line of code is just the equation inside the summation

Answers (2)

Walter Roberson
Walter Roberson on 1 Oct 2022
Use
x = linspace(-2, 4, 200);
Currently you are using x = [-2, -1, 0, 1, 2, 3, 4] which is not enough to get a decent graph.

Torsten
Torsten on 1 Oct 2022
x = (linspace(-2,4,200)).';
n = 1:5;
f = 1 - exp(-1) + 2*sum((1-(-1).^n*exp(-1))./(1+n.^2*pi^2).*cos(n.*pi.*x),2);
plot(x,f)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!