%Section 12.4 problem no. 57 (c).
%The vibrating string.

a = 1;
k = 3;

r = 500;
dt = 0.03;
T = r*dt;

x = 0:0.05:pi;

figure(1)

for t=0:dt:T
    y = sin(k*x).*cos(k*a*t);
    plot(x,y);
    axis([0 pi -1.5 1.5])
    drawnow
end


