%EEMAG1 Fall 99
%S. Mandayam, ECE, Rowan University
%Code to generate movie of
%2-D space and time varying scalar field (spactimscal)

close all; clear;
x = -2:.2:2; y = -1:.2:1;    
[xx,yy] = meshgrid(x,y);     
 
% Set graphics parameters.
axis([-2 2 -2 2 -1 1]);
hold on

% Generate the movie.
delt = 0.1;
nframes = 24;
M = moviein(nframes);
for k = 1:nframes,
    % Coefficients
    t = k*delt;
    s = t*xx.*exp(-xx.^2-yy.^2);
    
    cla;
    surf(x,y,s);shading interp;
   
    % Capture the frame
    M(:,k) = getframe;
 end;
hold off

% save the movie
save spactimscalmovie M;
