% Phasor plot % Kenyon fig. 5.5 p. 101 % Ploting the phase diagram for the addition of two plane waves with a phase difference of phi. % Steven Sahyun 140930 clf(); d = 5000; %slit separation in nm lambda = 650; %wavelength in nm k = 2*pi/lambda; y = 2; screen = 100; theta = atan(y/screen); phi=k*d*sin(theta); %phi = pi/4; %phase difference between the two waves. t=0; max=2; %for size of graph x = 0; w = 1/10; for t = 1:126 clf; hold on; E1 = cos(k*x-w*t)+i*sin(k*x-w*t); %First wave E2 = cos(k*x-w*t+phi)+i*sin(k*x-w*t+phi); % Second Wave Esum = E1+E2; quiver(0,0,real(E1),imag(E1)) %quiver plots a vector arrow. quiver(real(E1),imag(E1),real(E2),imag(E2)) quiver(0,0,real(Esum),imag(Esum)) title('Phasor Diagram for the addition of two Plane Waves'); xlabel('Real'); ylabel('Imaginary'); legend('E1', 'E2', 'E=E1+E2'); axis([-max,max,-max,max], 'square') M(t) = getframe; end