close all
x = [-100:100]; y = [-100:100]; [x,y] = meshgrid(x,y);
f = 2; toff = .2; v = 100;
for t=0:.01:1
e = cos(2*pi*f*(t+x/v)).*(x<0).*(x>-v*t).*(x<-v*(t-toff)) +... cos(2*pi*f*(t-x/v)).*(x>=0).*(x<v*t).*(x>v*(t-toff));
surf(x,y,e) axis([-100 100 -100 100 -1 1]) caxis([-1 1]) shading interp drawnow
if t==0 pause end
end