% function travelwave
% mhandle = travelwave
% Output mhandle: movie handle
% Plots the the function f versus z for various times t, with 
% the function f given in problem P3.20 in the textbook by Rao. 
% Sets up a movie of the result

function mhandle = travelwave
z  =  [-100 0 100 300]; % positions for 4 function samples
f  =  [0 1 -1 0]; % initial pulse shape

% set up movie with 91 time samples 
for t = 1:1:91
    zt =  [-200 z + 10*(t-1) 1200];
    ft =  [0 f 0];
    plot (zt, ft);
    title  ('Travelling wave')
    xlabel ('Propagation distance')
    ylabel ('Amplitude')
    M(t) = getframe;
end
% movie(M) % plays the movie 
mhandle = M;
return

   



