% Prácticas Bloque EDP- AM
% Sobre hoja 8 - Ejercicio 5 
% Curso 2020-21
%
function y= vibracionescuerda_AM(n)
% 
syms x t
f=(heaviside(x-1/4)-heaviside(x-3/4))*((x-1/2)^2-1/16);
% 
u=0;
for i=1:n
   c(i)=int(sin(i*pi*x)*f,x,0,1)/int((sin(pi*i*x))^2,x,0,1);    
   u=u+c(i)*sin(pi*i*x)*cos(pi*3*i*t); 
end
aproximacion=u;
pretty(aproximacion)
%  
ezsurf(u,[0,2],[0,1])
% 
pause
ezplot(subs(u,t,0),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
ezplot(subs(u,t,0.1),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
ezplot(subs(u,t,0.2),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
ezplot(subs(u,t,0.3),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
ezplot(subs(u,t,0.4),[0,1])
axis([0,1,-0.1,0.1])
% 
pause
ezplot(subs(u,t,1/2),[0,1])
axis([0,1,-0.1,0.1])
pause
% en t=1
ezplot(subs(u,t,1/2+0.1),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
ezplot(subs(u,t,1/2+0.3),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
ezplot(subs(u,t,1/2+0.4),[0,1])
axis([0,1,-0.1,0.1])
pause
ezplot(subs(u,t,1),[0,1])
axis([0,1,-0.1,0.1])
pause
% 
ezplot(subs(u,t,3/2),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
ezplot(subs(u,t,2),[0,1])
axis([0,1,-0.1,0.1])
pause
% 
ezplot(subs(u,t,3),[0,1])
axis([0,1,-0.1,0.1])
pause
%  
for j=1:81
   dt=(j-1)*0.1
ezplot(subs(u,t,dt),[-1,1]);
axis([0,1,-0.1,0.1])
%pause
getframe;
end

    

 


