PHYS 408 HOMEWORK 8 SOLUTIONS

Premask post mask g ifft2postmask output colormap

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: all smax = 20; % max spatial coordinate theta0 = 0.005236; % = (1E-4)*(2*pi/(6E-1))*(5) N = 2^8+1; % discretization s = linspace(-smax,smax,N); % spatial coordinate vector theta = zeros(N); % initialize theta function % define extent of nucleus for m = 1:N; for n = 1:N; if(abs(s(m)) < 10 && abs(s(n)) < 10) theta(m,n) = theta0; end; end; end; f = exp(i*theta); % input field, within constant phase pre_mask = fft2(f); % calculate field just before mask mask = ones(N); % initialize mask to perfect transmission mask(1,1) = i; % modify select element of mask post_mask = mask.*pre_mask; % post-mask g = ifft2(post_mask); % output colormap gray; ext = [-smax smax -smax smax]; subplot(5,2,1); pcolor(s,s,theta); ... title(’theta’); shading flat; axis equal; axis(ext); subplot(5,2,2); pcolor(s,s,abs(f).^2); title(’|f|^2’); shading flat; axis equal; axis(ext); subplot(5,2,3); pcolor(s,s,real(fftshift(pre_mask))); title(’Re(p_{<mask})’); shading flat; axis equal; axis(ext/10); subplot(5,2,4); pcolor(s,s,imag(fftshift(pre_mask))); title(’Im(p_{<mask})’); shading flat; axis...
View Full Document

This document was uploaded on 03/11/2014 for the course PHYS 408 at University of British Columbia.

Ask a homework question - tutors are online