% 设置参数
width = 512; % 图像宽度
height = 512; % 图像高度
center_x = width / 2; % 中心点x坐标
center_y = height / 2; % 中心点y坐标
wavelength = 633e-9; % 光束波长
charge = 1; % 涡旋光束的角动量
% 创建相位图
phase = zeros(height, width);
for y = 1:height
for x = 1:width
r = sqrt((x - center_x)^2 + (y - center_y)^2); % 距离中心点的距离
theta = atan2(y - center_y, x - center_x); % 角度
% 计算相位
phase(y, x) = charge * theta;
end
end
% 显示相位图
figure;
imagesc(phase);
colormap('gray');
title('Phase map for vortex beam');
colorbar;
更改charge的值即可得到不同l对应的涡旋光束