Here is a movie of this solution from time t=0 to t=3 -- you can download it and (hopefully) play it with a program such as xine, quicktime, windows media player, etc.
To make this movie for yourself using matlab, first save the file hammer.m as a plain text file in a directory on your computer (you can also do this by starting matlab, choosing "new m-file" from the file menu, and copying the lines in hammer.m). Then, in matlab you will be able to use the function hammer(x,t,a,c) to find the shape of the string u(x,t) at the point x and time t (|x| < a is the interval where the initial data is 1, and c is the speed in the wave equation u_tt = c^2 u_xx). Notice that the solution is calculated by looking at cases much like you did on your homework problem.
Start matlab and make sure the current directory is the directory where hammer.m is stored. Type the following at the prompt in matlab:
  
>> X=5; T = 3; L = 100; a = 1; c = 1;
  
>> x = -X:.01:X;
  
>> for n = 1:(T*L+1)
  
plot(x, hammer(x,(n-1)/L,a,c));
  
axis([-X,X,0, a/c + .1])
  
M(n) = getframe;
  
end
You can also change the parameters to speed up or slow down the wave. For example, try letting a = 2 and c = 1/2,
  
>> X = 9; T = 10; L = 100; a = 2; c = .5;
  
>> x = -X:.01:X;
  
>> for n = 1:(T*L+1)
 
plot(x, hammer(x,(n-1)/L,a,c));
 
axis([-X,X,0, a/c + .1])
  
M(n) = getframe;
  
end
The movie can be replayed by typing "movie(M)" at the matlab prompt. Here's the movie made from the above script: hammer blow with speed 1/2
We can also make a movie of the sine wave we solved for in class. If the initial velocity is 0 and the initial shape is u(x,0) = sin(x), we found the solution of the wave equation is u(x,t) = 1/2(sin(x-ct) + sin(x+ct)). The movie below shows the part of this wave that moves to the right in red, and the part that moves to the left in blue. The actual solution u(x,t) is graphed in black; it is the sum of the red and blue waves.
Matlab code:
  
>> c = 1; T = 2*pi; L = 100; x=-2*pi:.01:2*pi;
  
>> for n = 1:(T*L+1)
  
plot(x, .5*(sin(x+c*(n-1)/L) + sin(x-c*(n-1)/L)), 'black')
  
hold on;
  
plot(x, .5*(sin(x-c*(n-1)/L)), 'red')
  
plot(x, .5*(sin(x+c*(n-1)/L)), 'blue')
  
hold off;
  
axis([-2*pi, 2*pi, -1.1, 1.1])
  
M(n) = getframe;
  
end;
Here's an movie
of a solution of the wave equation on the half-line,
with the Dirichlet boundary condition u(0,t)=0 at x=0. The initial
velocity is 0, and the initial wave is u(x,0)=sin(x) on the interval [2*pi,4*pi]
and 0 everywhere else.
Here's the Matlab code for this movie:
(you'll need reflection.m)
  
>> x=0:.01:27
  
>> for n=1:700
  
plot(x, reflection(x, n/100 - .01))
  
axis([0,27,-1.1,1.1])
  
M(n) = getframe;
  
end