Fourier series with MATLAB
1 view (last 30 days)
Show older comments
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 Comment
Akira Agata
on 25 May 2017
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);
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!