
%Prácticas curso AM, IC, 2020_21
function y= seriefourierAM(n)
syms x 
%f=x
f=(heaviside(x-1/4)-heaviside(x-3/4))*((x-1/2)^2-1/16)
ezplot(f,[0,1])
hold on
Sn=0;
for i=1:n
   c(i)=int(sin(i*pi*x)*f,0,1)/int((sin(pi*i*x))^2,0,1);  
   Sn=Sn+c(i)*sin(pi*i*x); 
end
%
aproximacion=Sn;
pretty(aproximacion)
ezplot(Sn,[0,1])
hold off
 
