%Chapt2Fig2.m
%interference of two waves
%y is intensity
%amplitude is amp1 and amp2
clear;
clf;

amp1=1.;					%amplitude of wave 1
amp2=1.;					%amplitude of wave 2
xmax=6.0;
step=xmax/200;

x=[0:step:xmax];			%[start:increment:stop];
   
y=amp1^2+amp2^2+2*amp1*amp2*cos(pi*x);

figure(1);
plot(x,y,'b');
temp2=['Chapt2Fig2, Amp_1 = ',num2str(amp1),', Amp_2 = ',num2str(amp2)];
title(temp2);
xlabel(['Phase, \phi(\pi)']);
ylabel(['Intensity']);
