How to plot a slice of the focal point in the radial direction.
I have energy intensity data from an FDTD simulation of a multilevel diffractive lens. Below is the MATLAB code I use to create a normalized intensity distribution, showing how the intensity of light varies with distance from a reference point (MDL) and radial distance:
dataset_er_r = ‘/er.r’; % Select dataset within the selected h5 file
dataset_er_i = ‘/er.i’; % Select dataset within the selected h5 file
data_er_r = h5read(‘/pathto/fdtd_wvl_0.532_1-er-000200.00.h5’, dataset_er_r); % Read HDF5 file
data_er_i = h5read(‘/pathto/fdtd_wvl_0.532_1-out/fdtd_wvl_0.532_1-er-000200.00.h5’, dataset_er_i); % Read HDF5 file
data_er = abs(sqrt((data_er_r).^2+(data_er_i).^2));
data_Ir = (data_er.^2)/2;
data_Ir_norm = data_Ir./max(max(data_Ir));
data_Ir_norm2 = vertcat(flipud(data_Ir_norm),data_Ir_norm);
% Show intensity distribution
imagesc(data_Ir_norm2); colormap jet; colorbar; clim([0 1]);
set(gcf,’Position’,[300,300,1000,1000]);
title(‘wavelength = 532 nm’, ‘FontSize’, 80);
xlabel(‘Distance from FZP (um)’, ‘FontSize’, 40);
ylabel(‘R (um)’, ‘FontSize’, 40);
set(gca, ‘FontSize’, 40); % Set axis font size
set(gca, ‘TickLabelInterpreter’, ‘none’, ‘FontSize’, 20); % Increase tick label font size
num_points = size(data_Ir_norm2, 2);
xticks(linspace(1, num_points, 5)); % 7 tick marks for 0, 10, 20, 30, 40, 50, 60
xticklabels({‘0′,’5′, ’10’, ’15’, ’20’});
yticks(linspace(1, size(data_Ir_norm2, 1), 6));
yticklabels(linspace(-50, 50, 6));
This creates this plot:
This code creates a plot to show the focal points. I would like to alter the code so that it shows a slice in the radial direction where the focal point is brightest. Being new to MATLAB, I’m unsure how to achieve this or if there is a specific function that can identify the brightest point and plot a slice in the radial direction, similar to the provided example plot.
Any advice or help would be greatly appreciated!I have energy intensity data from an FDTD simulation of a multilevel diffractive lens. Below is the MATLAB code I use to create a normalized intensity distribution, showing how the intensity of light varies with distance from a reference point (MDL) and radial distance:
dataset_er_r = ‘/er.r’; % Select dataset within the selected h5 file
dataset_er_i = ‘/er.i’; % Select dataset within the selected h5 file
data_er_r = h5read(‘/pathto/fdtd_wvl_0.532_1-er-000200.00.h5’, dataset_er_r); % Read HDF5 file
data_er_i = h5read(‘/pathto/fdtd_wvl_0.532_1-out/fdtd_wvl_0.532_1-er-000200.00.h5’, dataset_er_i); % Read HDF5 file
data_er = abs(sqrt((data_er_r).^2+(data_er_i).^2));
data_Ir = (data_er.^2)/2;
data_Ir_norm = data_Ir./max(max(data_Ir));
data_Ir_norm2 = vertcat(flipud(data_Ir_norm),data_Ir_norm);
% Show intensity distribution
imagesc(data_Ir_norm2); colormap jet; colorbar; clim([0 1]);
set(gcf,’Position’,[300,300,1000,1000]);
title(‘wavelength = 532 nm’, ‘FontSize’, 80);
xlabel(‘Distance from FZP (um)’, ‘FontSize’, 40);
ylabel(‘R (um)’, ‘FontSize’, 40);
set(gca, ‘FontSize’, 40); % Set axis font size
set(gca, ‘TickLabelInterpreter’, ‘none’, ‘FontSize’, 20); % Increase tick label font size
num_points = size(data_Ir_norm2, 2);
xticks(linspace(1, num_points, 5)); % 7 tick marks for 0, 10, 20, 30, 40, 50, 60
xticklabels({‘0′,’5′, ’10’, ’15’, ’20’});
yticks(linspace(1, size(data_Ir_norm2, 1), 6));
yticklabels(linspace(-50, 50, 6));
This creates this plot:
This code creates a plot to show the focal points. I would like to alter the code so that it shows a slice in the radial direction where the focal point is brightest. Being new to MATLAB, I’m unsure how to achieve this or if there is a specific function that can identify the brightest point and plot a slice in the radial direction, similar to the provided example plot.
Any advice or help would be greatly appreciated! I have energy intensity data from an FDTD simulation of a multilevel diffractive lens. Below is the MATLAB code I use to create a normalized intensity distribution, showing how the intensity of light varies with distance from a reference point (MDL) and radial distance:
dataset_er_r = ‘/er.r’; % Select dataset within the selected h5 file
dataset_er_i = ‘/er.i’; % Select dataset within the selected h5 file
data_er_r = h5read(‘/pathto/fdtd_wvl_0.532_1-er-000200.00.h5’, dataset_er_r); % Read HDF5 file
data_er_i = h5read(‘/pathto/fdtd_wvl_0.532_1-out/fdtd_wvl_0.532_1-er-000200.00.h5’, dataset_er_i); % Read HDF5 file
data_er = abs(sqrt((data_er_r).^2+(data_er_i).^2));
data_Ir = (data_er.^2)/2;
data_Ir_norm = data_Ir./max(max(data_Ir));
data_Ir_norm2 = vertcat(flipud(data_Ir_norm),data_Ir_norm);
% Show intensity distribution
imagesc(data_Ir_norm2); colormap jet; colorbar; clim([0 1]);
set(gcf,’Position’,[300,300,1000,1000]);
title(‘wavelength = 532 nm’, ‘FontSize’, 80);
xlabel(‘Distance from FZP (um)’, ‘FontSize’, 40);
ylabel(‘R (um)’, ‘FontSize’, 40);
set(gca, ‘FontSize’, 40); % Set axis font size
set(gca, ‘TickLabelInterpreter’, ‘none’, ‘FontSize’, 20); % Increase tick label font size
num_points = size(data_Ir_norm2, 2);
xticks(linspace(1, num_points, 5)); % 7 tick marks for 0, 10, 20, 30, 40, 50, 60
xticklabels({‘0′,’5′, ’10’, ’15’, ’20’});
yticks(linspace(1, size(data_Ir_norm2, 1), 6));
yticklabels(linspace(-50, 50, 6));
This creates this plot:
This code creates a plot to show the focal points. I would like to alter the code so that it shows a slice in the radial direction where the focal point is brightest. Being new to MATLAB, I’m unsure how to achieve this or if there is a specific function that can identify the brightest point and plot a slice in the radial direction, similar to the provided example plot.
Any advice or help would be greatly appreciated! fdtd, diffractive lenses, data visualization, intensity distribution, radial slice, point spread function, plotting, image processing MATLAB Answers — New Questions