![]() |
||||||
|
| Script S4_1_1.m | |||
|
|||
|
%==============================================
%Superposition of waves %============================================== % %a conventional value of lambda lambda=1; %a distance d (=lambda/6) between two waves %corresponding to a phase shift of 360°/6 = 60° d=lambda/6 %each wave is defined by 20 points %four waves of wavelength lambda %and four waves of wavelength lambda+d %are considered max=80 %points for the first wave z1=linspace(eps,4*lambda,max); %points for the second wave z2=z1+d; %values for the abscissa of the plot z=linspace(eps,4*(lambda+d),max); %the value of magnitude of the wave vector %(see Sec.1.1.6, pag.10) k=2*pi/lambda; %the phase shifts in radians fi1=k*z1; fi2=k*z2; %corresponding values in degrees fi1g=fi1*180/pi; fi2g=fi2*180/pi; %the phase shifts in the intervall 0°-360° f1mod=mod(fi1g,360) f2mod=mod(fi2g,360) %the corresponding harmonic waves y1=sin(fi1); y2=sin(fi2); %their superposition y=y1+y2; finez=z(end) %plot of the pair y1, y2 and of their superposition %considering four wavelengths plot(z,y1,'ro-',z,y2,'bd-',z,y,'g-*'),grid on title('four waves y1(red),y2(blue),y(green)') axis([0,4.7,-1.75,1.75]) figure % %considering two wavelengths only (as appear in the book) plot(z,y1,'ro-',z,y2,'bd-',z,y,'g-*'),grid on title('two waves y1(red),y2(blue),y(green)') axis([0,2,-1.75,1.75]) figure % %corresponding intensity %varying d (now called x) between 0 and lambda x=linspace(0,lambda,max); %corresponding fi/2 (now called fi_h, see last formula in pag.155) fi_h=k*x/2; %also in degrees fig=fi_h*180/pi; %corresponding intensity Ir=4*(cos(fi_h)).^2; plot(fig,Ir,'r-o'),grid on title('Relative intensity function of fi/2') %============================================== % |
|||
| Top | |||