%%% animation.m: to run this script, at the matlab prompt type %%% animation %%% %%% contains a Matlab animation example % define the x-axis grid x = -30:30; % define the axes dimensions and preserve them v = [-30,30,0,0.3]; hold off; % define number of frames and create frames M = moviein(20); for i = 1:20, for j = 1:61, u(j) = exp(-x(j)^2/(4*pi*i))/(sqrt(4*pi*i)); end plot(x,u,'g'); axis(v); if i == 1 v = axis; end M(:,i) = getframe; end % run animation movie(M,4,20)