You are on page 1of 1

sum=0;

%Suma aproximada
for k=1:10
ank=subs(an,n,k);
bnk=subs(bn,n,k);

sum=sum+ank*cos(k*x)+bnk*sin(k*x);
end
suma=a0/2+sum; %a�adimos el t�rmino independiente

%Representaci�n de la suma
xv=linspace(a,b);
y=subs(suma,x,xv);
plot(xv,y)
grid on
hold on

%Representaci�n de la funci�n f definida a trozos


t1=linspace(a,0);
t2=linspace(0,b);
t=[t1,t2];
v=[0*t1,t2];
plot(t,v,'r')
hold off

You might also like