Contents
A vibrating string
The following commands create and show an animation of the solution of the wave equation . In the animation, . This solves the equation with initial value and boundary values .
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)