% kdv_movie.m SCRIPT file % % Compute a solution of the KdV wave equation and show a movie of it. % nx = 64; nt = 120; [ u, x, t ] = kdv_mid ( nx, nt ); % % Set up a movie. % Frames = moviein ( nt ); for it = 1 : nt it plot ( x, u(it,:) ); axis ( [ -6.0, 6.0, -1.0, 9.0 ] ); Frames(:,it) = getframe; end % % Show the movie twice. % movie ( Frames, 2 )