BeamLab 1.2

Say hi to BeamLab 1.2 — our biggest release yet! Read on to learn more about the most exciting new features and performance improvements (jump to release notes).

Enhanced waveguide design flexibility

In BeamLab 1.2, we’ve added a new class of functions called path functions. These functions allow the definition of complex 3D trajectories with just a few lines of MATLAB® code, making the definition of complex waveguide structures both easy and flexible. Instead of having to split up a complex waveguide structure into many different simpler waveguide sections, the entire structure can now be directly defined in a single section with a much shorter and simpler code as exemplified below for the case of our directional coupler demo:

options.ShiftType = 'custom';

points = [20 0 0;
    20 0 100;
    -2 0 1600;
    -2 0 5600;
    20 0 7100];
options.ShiftFunction{1} = @(z) linsinpath(z,points);

points = [-20 0 0];
options.ShiftFunction{2} = @(z) linsinpath(z,points);

Here, the function linsinpath is one of our new path functions which creates a 3D trajectory consisting of sinusoidal transitions, linear transitions, or combinations thereof, connecting an arbitrary number of points defined as a N x 3 matrix with each row corresponding to the x-, y-, and z-coordinates of a transition point in space.

One of our new demos showcasing this new feature is an integrated RGB beam combiner [1] where all three waveguide arms are defined by these path functions:

Intensity profiles in the RGB beam combiner (left: red input channel; center: green input channel; right: blue input channel)

The following video shows the beam propagation through the RGB beam combiner for each of the three color channels:

Video of red, green, and blue beams propagating in the RGB beam combiner

Simplified coding

Applications that make use of new BeamLab 1.2 functions such as path functions and the input field function modeinput can reduce the code length by more than 70%. For example, the waveguide definition of our directional coupler demo required 105 lines of code in BeamLab 1.1, but can be reduced to less than 30 lines of code in BeamLab 1.2, as exemplified in the code snippet shown above.

Exciting new demos

We’ve added a new Mach-Zehnder interferometer (MZI) demo with two input and two output arms showcasing xz slice plots of the real part of the propagating complex electric field (in contrast to the absolute value that is typically shown in BPM based plots). This is just one example of the many new plotting possibilities enabled by the newly added parameter SlicesXZGraphType in BeamLab 1.2:

Field profiles in the MZI (left: complete propagation structure; right: detail plot)

We also added a new demo that demonstrates deflection of a Gaussian beam in free space by a series of ideal prisms using the new waveguide function thinprism:

Video of beam deflection via multiple prisms

Interested in more examples? Please also check out our examples page.

Improved parameter orders

In BeamLab 1.2, we’ve also changed the parameter order of the waveguide functions multicore, plc, and rib to improve consistency throughout all waveguide functions. Along with this change, we’ve also replaced the required parameter shift by an optional parameter Shift in the plc waveguide function. The new parameter order allows you now to change your propagation structure more easily from one type of waveguide to another, e.g., from plc to rib.

BeamLab 1.1 and earlier:


Starting in BeamLab 1.2:



[1] A. Nakao et al., “Integrated waveguide-type red-green-blue beam combiners for compact projection-type displays,” Optics Communications, vol. 330, pp. 45-48, 2014.

Release Notes

New features:

  • Add new class of path functions. These functions allow the definition of complex 3D trajectories with just a few lines of MATLAB® code, making the definition of complex waveguide structures both easy and flexible. They can be used anywhere in BeamLab, where custom functions define a lateral offset in x- and y-direction as a function of the longitudinal z-value. For example, path functions can be used as ShiftFunction in the waveguide functions singlecore, multicore, plc, and rib to define complex trajectories along which waveguide cores are shifted. Path functions can also be used as custom PowerCenterFunction and PowerAreaTransitionFunction in a large number of waveguide functions, offering a high flexibility in terms of defining power calculation trajectories and areas, respectively.
  • Add path function linsinpath, which interpolates the lateral x- and y-values between transition points via sine functions, linear functions, or combinations thereof. The optional parameter TransitionType specifies the absolute length of the sinusoidal transition after a transition point and before the next one. A value of 0 corresponds to a purely linear shift between two transition points and a value of Inf (or greater than the transition length between two transition points) corresponds to a purely sinusoidal transition, respectively.
  • Add path function splinepath, which uses the MATLAB® function spline for interpolating the lateral x- and y-values between transition points via a cubic spline interpolation.
  • Add path function pchippath, which uses the MATLAB® function pchip for interpolating the lateral x- and y-values between transition points via a piecewise cubic Hermite interpolating polynomial (PCHIP).
  • Add function modeinput. This function generates an input field for a BPM simulation based on the eigenmode number ModeNumber of the waveguide core specified in ModeCore of waveguide section specified in ModeSections instead of having to use a separate modesolver call in conjunction with custominput. The function modeinput uses the cached output from a previous call if the waveguide function and other relevant parameters have not changed. Since only the waveguide from the section specified in ModeSections is relevant for modeinput, other sections can be modified and/or additional sections can be added or sections can be removed without having to recalculate the input field.
  • Add function getcommonvars. This new function automatically returns all common variables, which have been defined in a waveguide function up to the point where getcommonvars is executed. This eliminates the need to manually specify the common variables which should not be cleared in a subsequent execution of sectionclear.
  • Add waveguide function thinprism. This function emulates an ideal prism of zero thickness that deflects an input beam by a specified angle.
  • Add waveguide function thinzernike. This function creates a circular phase screen defined by a Zernike polynomial.
  • Add demo rgb_beam_combiner, which simulates the beam propagation in an integrated silica RGB beam combiner using the new path function linsinpath for defining the waveguide structure.
  • Add demo mach_zehnder_interferometer, which simulates the beam propagation through a Mach-Zehnder interferometer (MZI) with two input and two output arms.
  • Add demo rib_splitter, which simulates the beam propagation in a polymer rib waveguide splitter using the new path function pchippath for defining the waveguide structure.
  • Add demo freespace_deflection, which simulates the deflection of a Gaussian beam by several ideal prisms using the new waveguide function thinprism.
  • Add demo directional_coupler_performance, which performs the same simulation much faster as the original demo directional_coupler by omitting the index scanner and live monitor functionalities.
  • Add possibility to define SuperGaussDegree in gaussinput for x- and y-direction independently.
  • Add parameters SlicesXZGraphType and SlicesYZGraphType. Similar to the parameter SlicesXYGraphType, these two new parameters specify the plot types of x-z and y-z slice plots. These parameters now allow also the generation of 2D or 3D slice plots of the real part, imaginary part, amplitude, or phase of the field distribution, besides the intensity distribution.
  • Add parameter ModeCore. This parameter specifies a single core in a multi-core type waveguide function, such as multicore, plc, or rib, to be used for a mode evaluation. In conjunction with the input function modeinput, it can be used to select a specific core as the location of field input for BPM simulations, and thus eliminates the need for defining a separate dummy waveguide section that was hitherto used only for an input field specific mode evaluation.
  • Add parameter NumericalAperture to gaussinput to take into account the numerical aperture of the optical system generating the Gaussian input beam. When set to Inf (which corresponds to the default value), also beam waists beyond the classical resolution limit can be generated, e.g., beam widths smaller than the wavelength. Note however that the use of such small beam waists cause the beam to strongly diverge shortly behind the location of the waist.
  • Add new materials to material database.


  • Change parameter order in waveguide functions multicore, plc, and rib to improve consistency throughout all waveguide functions.
  • Replace required parameter shift by optional parameter Shift in plc waveguide function.
  • Improve dispersionsolver to work also with complex refractive indices.
  • Improve input field functions.
  • Improve waveguide functions with respect to 2D calculations.
  • Improve memory efficiency in modesolver.
  • Remove numerical noise in imaginary part of modes.
  • Remove restriction of the video export functionality requiring MATLAB version 8.2 (R2013b) or later.
  • Use IndexRange also for all monitor and x-y slice plots.
  • Add possibility to define MonitorGraphType, SlicesXYGraphType, SlicesXZGraphType, SlicesYZGraphType, IndexSlicesXYGraphType, and DispersionGraphType as string.
  • Add possibility to set SlicesXYGraphType, SlicesXZGraphType, SlicesYZGraphType in bpmplot independent of previous choices.
  • Add possibility to set SlicesXYGraphType in modeplot independent of previous choices.
  • Add possibility to define CoreShapeFactor, Shift, and ShiftEnd as cell arrays in rib.
  • Add possibility to change the faceted shading line width via optional parameter LineWidth.
  • Add general tips how to reduce the overall computation time of BeamLab simulations to documentation.
  • Add subdirectories to demos directory.
  • Improve titles and axis labels.
  • Improve warning and error messages.
  • Improve demo scripts.
  • Improve documentation.

Bug fixes:

  • Fix bug with respect to semi-vectorial calculations using y-polarization.
  • Fix units of field and intensity distributions for 2D calculations.
  • Fix bug in plc when using materials from the material database.
  • Fix bug in rib waveguide function with respect to 2D calculations.
  • Fix bug in stacked slices plots when plotting the field’s phase.
  • Various minor bug fixes.