function u=svexmp2(T,XX,TT,N)
%wave equation with zero DC BC in (0,pi)
%initial position - x*(x-pi)
%initial momentum - 0
x=linspace(0,pi,XX);
t=linspace(0,T,TT);
u=zeros(TT,XX);
%u(x,t)=sum((-4/(n^3*pi))*((-1)^(n+1)+1)*cos(2*n*t)*sin(n*x)
for i=1:TT
    for n=1:N
    u(i,:)=u(i,:)+(-4/(n^3*pi))*((-1)^(n+1)+1)*cos(2*n*t(i))*sin(n*x);
    end
end

figure(1)
subplot(6,1,1)
plot(x,u(1,:))
subplot(6,1,2)
plot(x,u(TT/5,:))
subplot(6,1,3)
plot(x,u(2*TT/5,:))
subplot(6,1,4)
plot(x,u(3*TT/5,:))
subplot(6,1,5)
plot(x,u(4*TT/5,:))
subplot(6,1,6)
plot(x,u(TT,:))