lmda=500e-9;
>> r=1e-3;%
>> f=1;%焦距
>> N=19;
>> K=linspace(-0.1,0.1,N);
>> lmda1=lmda*(1+K);
>> xm=2000*lmda*f;
>> xs=linspace(-xm,xm,2000);
>> ys=xs;
>> z0=zeros(2000);
>> [x,y]=meshgrid(xs);
>> for i=1:19
s=2*pi*r*sqrt(x.^2+y.^2)./(lmda1(i));
z=4*(besselj(1,s)./(s+eps)).^2;
z0=z0+z;end
z1=z0/19;
subplot(2,2,1)
imshow(z1*255);
>> title('非单色光圆孔衍射')
>> xlabel('x')
>> ylabel('y')
>> subplot(2,2,2)
>> mesh(x,y,z1)
>> colormap(gray)
>> subplot(1,2,2)
>> plot(z,ys);
>> r=1e-3;%
>> f=1;%焦距
>> N=19;
>> K=linspace(-0.1,0.1,N);
>> lmda1=lmda*(1+K);
>> xm=2000*lmda*f;
>> xs=linspace(-xm,xm,2000);
>> ys=xs;
>> z0=zeros(2000);
>> [x,y]=meshgrid(xs);
>> for i=1:19
s=2*pi*r*sqrt(x.^2+y.^2)./(lmda1(i));
z=4*(besselj(1,s)./(s+eps)).^2;
z0=z0+z;end
z1=z0/19;
subplot(2,2,1)
imshow(z1*255);
>> title('非单色光圆孔衍射')
>> xlabel('x')
>> ylabel('y')
>> subplot(2,2,2)
>> mesh(x,y,z1)
>> colormap(gray)
>> subplot(1,2,2)
>> plot(z,ys);