Fourier series doesnt overlap function

b = zeros(1,7);
x = linspace(-2,2,200);
f = ((8+x.^3)).^(1/2);
b0 = trapz(x,f);
for n = 1:7
y = f.*sin(n*pi*x/2);
b(n) = trapz(x,y);
end
fh = zeros(1,200);
for n = 1:7
fh = fh + b(n)*sin(n*pi*x/2);
end
fh = b0/2 + fh;
plot(x,f,'r','LineWidth',3)
hold on
plot(x,fh,'b','LineWidth',1)
hold off
legend('f','fh','Location','best')
title('N/A')
Can anyone see why the fourier series of f doesnt line up with the function f?

回答 (0 件)

この質問は閉じられています。

タグ

質問済み:

2019 年 1 月 26 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by