This article provides step-by-step instructions to create a field profile image with an overlaid vector plot using Lumerical FDTD and MATLAB.
- Open and run the simulation file, [[vector_overlay.fsp]]
- Load the script file, [[vector_overlay.lsf]] and specify the target wavelength and resolution of the field data to be saved into a .mat format
- In MATLAB, run the following script
load(‘field_data.mat’);
[M,h1] = contourf(X1*1e6,Z1*1e6,sqrt(real(Ex1).^2+real(Ez1).^2),50);
colormap jet
set(h1,‘LineColor’,‘none’)
hold on;
h2 = quiver(X2*1e6,Z2*1e6,real(Ex2),real(Ez2)); % vector plot
xlabel(‘x(um)’); ylabel(‘z(um)’);
set(h2,‘Color’,[1 1 1])
This will produce the following image in MATLAB.