Demo entry 5334257

sdfsdf

   

Submitted by sdf on Jun 16, 2016 at 15:37
Language: Matlab. Code size: 636 Bytes.

```matlab
%% AngularSpectrumMethod
% This function propagates image from z1 to z2
% image stands for intensity.
function [image2, phase2] = AngularSpectrumMethod(image1, phase1 z1, z2, wavelength)

k = 2 * pi / wavelength;  % Wave Vector

[ly, lx] = size(iamge1);
kmeshx = 2 * pi / lx; kmeshy = 2 * pi / ly;
kx = ( (1 : lx) - lx / 2 - 1) * kmeshx;
ky = ( (1 : ly) - ly / 2 - 1) * kmeshy;
kx = fftshift(kx); ky = fftshift(ky);
[kkx, kky] = meshgrid(kx, ky);
image2 = ifft2(exp(1i * sqrt(k^2 - kkx .^ 2 - kky .^ 2) * (z2 - z1) ) .* fft2(images1 .* exp(1i * phase1) ) );
phase2 = angle(image2);
image2 = abs(image2);
```

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).