Graphing partial sums of harmonic fourier series

14 Ansichten (letzte 30 Tage)
lala land
lala land am 1 Okt. 2022
Beantwortet: Torsten am 1 Okt. 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

Antworten (2)

Walter Roberson
Walter Roberson am 1 Okt. 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 am 1 Okt. 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)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by