%Program to demonstrate some properties of Wave Motion.  
%Probably used in Lab for Optics.
%Version D. W. Donovan 2004-01-15
clear all;
A=10.0;%Define Amplitude of wave
p0=0.0;%Define Initial Phase Angle of wave
T=1.0;%Define Period of wave
L=1.0;%Define Wavelength of wave
t1=[0*T:.1*T:1*T]';%Range of time in units of Period (T)
x1=[0*L:.01*L:1*L]';%Range of distance in units of Wavelength (L)
w=2*pi/T;
k=2*pi/L;
ii=0;
for b= 0:.1*T:T
     ii=ii+1;
    y(:,ii)=A*sin(k*x1-w*t1(ii)+p0);
end

figure
hold on
for bb=1:ii
    if (-1)^bb==1
        plot(x1,y(:,bb),'m')
    else
        plot(x1,y(:,bb),'c')
    end
end
xlabel('x,(units of \lambda)')
ylabel('\psi(x,t)')
tt0='\newline';
tt1='Plot of \psi(x,t) in both position and time';
tt2='D. W. Donovan - ';
tf=[tt1,tt0,tt2,date];
title(tf)

