Application Example: MATLAB Driven Optimization of Grating Coupler 2D-FDTD



The new Lumerical application programming interface (API) allows users to drive Lumerical applications from within MATLAB and take advantage of the robust optimization routines available from the MATLAB Optimization Toolbox.

In this example, we will demonstrate how MATLAB can be used to drive a multi-variable nonlinear optimization of a grating coupler in FDTD Solutions via Lumerical’s Automation API. In addition, we will demonstrate how to setup a MATLAB function based on arbitrary simulation parameters to specify a nonlinear constraint for the optimization.
While we focus on a specific example of a grating coupler in FDTD, the target audience includes anyone who is interested in driving and controlling Lumerical applications directly from MATLAB.

Learn more:

Here is a complete list of the related interoperability commands:


Dear staff,

I have gone through the grating coupler matlab optimization examples you suggested on the following link:

After updating the file directory, mat main sccript can indeed open and pass parameters to Lumerical.
However when I run the main script, I do find errors like “optimoptions function is undefined”.
In addition, I also found “fmincon” function is used but seems also undefined.

Is there any matlab file that define the those functions missing from that example page?

Arthur Teng


Dear staff,

I have recently found out that our company only provides Matlab 2010b and that old version does not contain “optimoptions” command in old optimization toolbox.

In that case, without a latest verion of matlab, is there any old command can do the same thing as “optioptions”?
Or how should I modify the example script to specify those optimization options (iternation, steps…)?

Arthur Teng


I agree that the problems were related to the matlab version and missing functions used in our script. Hence, to make the example from our website work you would need to do the following:

  1. Get version of matlab that supports fmincon and optimoptions
  2. Make sure to have optimization toolbox from Matlab as the optimization functions are not part of the basic distribution

Note that the example was prepared with 2016 versions of Matlab and Lumerical tools. 2010B Matlab is fairly old and while you might be able to make the integration work, I am quite certain that the optimization tools changed considerably since then.

While I cannot give you official support on behalf of Matlab team, I would suggest that you go to their support page and check the documentation for 2010b release where you could browse the available optimization tools and functions from that time: