Fourier series with MATLAB

1 次查看(过去 30 天)
Hello everybody,
I have a little trouble here, I'm working with Fourier series, I already calcule Ao, An and Bn these is the following code:
Ao = 0;
for i=1:length(f)
Ao = Ao +int(f(i),'t', inter(i), inter(i+1));
end
Ao = simplify(Ao/T);
An = 0;
wo = 2*pi/T;
for i=1:length(f)
An = An +int(f(i)*cos(n*wo*t), inter(i), inter(i+1));
end
An = simplify(2*An/T);
Bn = 0;
for i=1:length(f)
Bn = Bn +int(f(i)*sin(n*wo*t), inter(i), inter(i+1));
end
Bn = simplify(2*Bn/T);
But now I want to express like this form:
This is the following formula:
Thank you for your help
  1 个评论
Akira Agata
Akira Agata 2017-5-25
I'm not sure what you want to do, but I guess you are trying to do the following. The following code calculates the first equation of your post up to Nterm th terms.
t = linspace(0, 4*pi, 1000);
Nterm = 5;
ft = zeros(size(t));
for kk = 1:Nterm
ft = ft + sin((2*kk-1)*t)/(2*kk-1);
end
ft = ft*(4/pi);
figure
plot(t,ft);

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by