How do I plot spiral phase plate with staircase structure

11 views (last 30 days)
I am trying to plot spiral phase plate with staircase structure like this:
I have coded this:
% Set the azimuthal index to 1
azimuthal_index = 1;
% Parameters
refractive_index_spiral_plate = 1.489; % Refractive index of the spiral plate (n_o)
refractive_index_air = 1; % Refractive index of air (n_air)
wavelength = 632.8e-9; % Wavelength of He-Ne laser in meters
steps = 2 * pi / azimuthal_index; % Number of steps
theta_step = 2 * pi / steps; % Angle for each step
segments = 10; % Number of segments per step (assumed to be 10)
theta_segment = theta_step / segments; % Angle for each segment
% Calculate the height for the spiral plate
height = (wavelength / (4 * pi * (refractive_index_spiral_plate - refractive_index_air))) * azimuthal_index;
% Initialize variables
total_height = height; % Total height for the spiral plate
segment_heights = zeros(1, segments); % Array to store heights for each segment
% Calculate the height increment for each segment
height_increment = total_height / segments;
% Calculate the height for each segment with increasing values
for i = 1:segments
segment_heights(i) = i * height_increment;
end
% Define the transverse plane grid
[x, y] = meshgrid(linspace(-1, 1, 256), linspace(-1, 1, 256));
% Create the phase distribution on the transverse plane
phase = zeros(size(x));
for i = 1:segments
phase = phase + segment_heights(i) * sin(azimuthal_index * atan2(y, x) + i * theta_segment);
end
% Create the complex field with the desired phase distribution
complex_field = exp(1i * phase);
% Plot the phase distribution in grayscale
figure;
imagesc(angle(complex_field)); % Display the phase
colormap('gray'); % Set the colormap to grayscale
colorbar; % Add a color bar
axis equal;
title('Spiral Phase Pattern on Transverse Plane (Grayscale)');
That produces:
Now when i tried to do the staircase, it becomes like this:
% Create the 3D surface plot for the staircase structure
figure;
surf(x, y, phase_pattern, 'EdgeColor', 'none');
Unrecognized function or variable 'phase_pattern'.
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Retardation (radians)');
title('Staircase Structure in Azimuthally Varying Retardation');
colormap('parula'); % Color anything
view(30, 30); % Adjust plot
Appreciate any help!
  2 Comments
Mathieu NOE
Mathieu NOE on 8 Nov 2023
Edited: Mathieu NOE on 8 Nov 2023
hello
1/ we cannot reproduce the second plot as phase_pattern is undefined
2/ I had a hard time to understand how your code is supposed to generate the "spiral plate". Have to admit I was not very good in optics at school !
ILY
ILY on 9 Nov 2023
1/ I will look again the phase_pattern~ thank you for the input!

Sign in to comment.

Answers (1)

Altaïr
Altaïr on 4 Feb 2025
Hey @ILY,
To create a spiral phase plot with a staircase pattern, the floor function can be employed. Here's an example that transforms a normal spiral plot into a spiral staircase plot using the floor function.
% Define grid size and range
n = 500; % Grid size
x = linspace(-1, 1, n);
y = linspace(-1, 1, n);
[X, Y] = meshgrid(x, y);
% Calculate the azimuthal angle
theta = atan2(Y, X);
% Calculate the phase shift
phaseShift = mod(theta, 2*pi);
% Plot the surface
figure;
surf(X, Y, phaseShift, 'EdgeColor', 'none');
colorbar;
title('Spiral Phase Plate');
xlabel('X');
ylabel('Y');
zlabel('Phase Shift');
% Number of stairs
N = 20;
% Add staircase effect by adjusting the ZData
ZData = floor(phaseShift/(2*pi/N)) * (2*pi/N);
% Plot the surface
figure;
surf(X, Y, ZData, 'EdgeColor', 'none', 'FaceAlpha', 0.7);
colorbar;
title('Spiral Phase Plate with Staircase Surface');
xlabel('X');
ylabel('Y');
zlabel('Phase Shift');
The variable N represents the number of stairs. Increasing N will make the second plot resemble the first one more closely.
For more details on the floor function, please refer to the documentation page:

Categories

Find more on Environment and Clutter in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!