optics5
Contents
cylinder
try for w = 0.5, 1, 2
% diameter w w = 1; func = @(x,y) cyl(x,y,w); str = sprintf('diameter %g',w); [out in] = fourier2(func);
![](https://i-blog.csdnimg.cn/blog_migrate/c3e272d401b073082db774bfbadf5b86.png)
subplot(1,1,1); rgb = cat(3,in,in,in); imagesc([-4 4],[4 -4],rgb); axis equal axis square axis([-4 4 -4 4]);
![](https://i-blog.csdnimg.cn/blog_migrate/c3e4b2ff6b0f7ea64071987b20344e21.png)
close all g = logim(out,3); rgb = cat(3,g,g,g); image([-4 4],[4 -4],rgb); title(str); axis equal axis square axis([-4 4 -4 4]);
![](https://i-blog.csdnimg.cn/blog_migrate/733fbc10f52ddf8b5071ec35220d6b7e.png)
close all sz = size(out); N = sz(1); k = -N/2:N/2-1; width = 8; x = width*k/N; idy = find(x==0); y = out(:,idy); idx = find(abs(x)<2); yt = somb(w*x).^2; subplot(2,1,1); plot(x,y,x,yt); title(str); subplot(2,1,2); semilogy(x,y,x,yt); xlabel('cross-section x');
![](https://i-blog.csdnimg.cn/blog_migrate/3b738e97bb262d129e5d49a2b6160cd1.png)
shifted cylinder
w = 0.5;
xs = 2;
fprintf('shift %g',-xs);
func = @(x,y) cyl(x+xs,y,w);
fourier2(func);
shift -2
![](https://i-blog.csdnimg.cn/blog_migrate/69e09a0fa5f09b0a4d460b4c719a7241.png)
phase-shifted cylinder
w = 2; xi = 2; func = @(x,y) cyl(x,y,w).*exp(j*2*pi*xi*x); fourier2(func);
![](https://i-blog.csdnimg.cn/blog_migrate/0e7448454c6b771d5ef39c42ccd8cdbf.png)
interference of two apertures
w = 0.5; xs = 1; func = @(x,y) cyl(x+xs,y,w)+cyl(x-xs,y,w); out = fourier2(func); imshow(out);
![](https://i-blog.csdnimg.cn/blog_migrate/ab12c713a99da0a09f56825834d9c1d5.png)
moving apertures closer together
w = 0.5; xs = 0.5; func = @(x,y) cyl(x+xs,y,w)+cyl(x-xs,y,w); out = fourier2(func); imshow(out);
![](https://i-blog.csdnimg.cn/blog_migrate/d67e5341c0e647ea108a2033aeea8fd5.png)
effect of aperture shape
w = 0.5; xs = 1.0; func1 = @(x,y) cyl(x+xs,y,w)+cyl(x-xs,y,w); func2 = @(x,y) rect(x+xs,w).*rect(y,w)+rect(x-xs,w).*rect(y,w); [out1 in1] = fourier2(func1); [out2 in2] = fourier2(func2); subplot(2,3,1); imshow(in1); subplot(2,3,2); imshow(out1); subplot(2,3,3); imshow(logim(out1,3)); subplot(2,3,4); imshow(in2); subplot(2,3,5); imshow(out2); subplot(2,3,6); imshow(logim(out2,3));
![](https://i-blog.csdnimg.cn/blog_migrate/2b74bcf1e5724e55cb53148a06fdb818.png)
interference of three apertures
global n;
n = 1;
fourier(@func3);
![](https://i-blog.csdnimg.cn/blog_migrate/84fd8b1b1f6480e4defeca340596e5a0.png)
interference of five apertures
n = 2; fourier(@func3);
原文地址:http://www.johnloomis.org/eop513/notes/optics5/script5.html
下面这两张是我计算的加了个colormap(hot) 顿时赶脚高大上了