close all
sgm=2;
for lambda=[1,3,10,30],
    Nx=256;
    %lambda=.65;
    dx=.5;
    dz=2;
    Nx=800;
    Nz=500;
    x=dx*((1:Nx) - Nx/2);
    z=dz*(1:Nz);
    
    theta=30*180/pi;
    phase=exp((2i*pi*sin(theta)/lambda).*x);
    A0=(exp(-(x+2).^2./sgm^2).*phase).';
    n=ones(Nx,1)*(1-.2i);
    n(abs(x)<10)=1.4;
    
    
    [A]=bpm_fn(n,A0,dx,dz,Nz,lambda);
    size(A)
    figure
    %imshow(abs(A.*(ones(Nx,1)*exp(-1i.*km.*z))));
    %imshow(real((ones(Nx,1)*exp(-1i.*km.*z))));
U=abs(A);
%for ii=1:Nz,
%U(:,ii)=U(:,ii)./max(U(:,ii));
%end;
    imshow(U);
    %contour(real(A).^2);
    hold on
    %contour(n);
    hold off
    %hold on
    %plot(Nz);
    %hold off
    
end