%% A vibrating string % The following commands create and show % an animation of the solution of the wave equation % $u(x,t) = \sin(5x)\cos(5t),\ 0 < x < \pi,\ 0 < t < 2 \pi$. In the animation, % $t = n\pi/50$. This solves the equation with initial value $sin(5x)$ and % boundary values $u(0,t)=0, \ u_t(0,t)=0$. X = 0:0.01:pi; for n = 0:100 plot(X, sin(5*X)*cos(n*pi/10)), axis([0,pi,-2,2]) hold on plot(X,0*X, 'k') hold off M(n+1) = getframe; end mplay(M,6)