Graphing partial sums of harmonic fourier series

12 visualizzazioni (ultimi 30 giorni)
lala land
lala land il 1 Ott 2022
Risposto: Torsten il 1 Ott 2022
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

Risposte (2)

Walter Roberson
Walter Roberson il 1 Ott 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 il 1 Ott 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)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by