How do I create a source field of light through a circular aperture?

조회 수: 12 (최근 30일)
Janna Hinchliff
Janna Hinchliff 2020년 4월 8일
답변: darova 2020년 4월 8일
I have been trying to construct a code where I propagate a light source through a circular aperture. So far I have
L1=0.5; % side length
M=500; % number of samples
dx1=L1/M; % src sample interval
x1=-L1/2:dx1:L1/2-dx1; % src coords
y1=x1;
lambda=500*10^-9; % wavelength
k=2*pi/lambda; % wavenumber
w=0.05; % source half width (m)
z=500; % propagation dist and focal length (m)
[X1,Y1]=meshgrid(x1,x1);
u1=circ(sqrt(X1^2+Y1^2)/w); % src field
I1=abs(u1.^2); % src intensity
figure;
imagesc(x1,y1,I1);
axis square; axis xy;
colormap('gray'); xlabel('x (m)'); ylabel('y (m)');
title('z= 0 m');
but the intensity plot shown does not represent a circular source. Is my definition of u1 incorrect or have a made an error in the coding?
I have defined the function circ as
function[out]=circ(r)
%
% circle function
%
% evaluates circ(r)
% note: returns odd number of samples for diameter
%
out=abs(r)<=1;
end

채택된 답변

darova
darova 2020년 4월 8일
First of all you forgout about element-wise:
X1.^2 + Y.^2 % each element of matrix in power '2'
Here is what i tried

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by