r/Optics • u/BlueHash4 • 7d ago
Optical System Design and Analysis in MATLAB R2026b R2026b
I posted about optics in MATLAB R2026a earlier, back now to give you an update on the R2026b version!
At the lowest level, we now support biconic and Grid surface specifications for both mirrors and lenses. The grid sag is the swiss army knife to model any free form optical surface! It uses bilinear interpolation under the hood and its ray intersection implementation is quite performant. So in addition to 'as built' surface modelling, try it out for modelling XY Polynomials or Zernike surface definitions (meshgrid is your friend :)).
We added a couple more basic low level ray tracing routines: traceDirectedRays and traceAimedRay. Both return rich RayData which has all raw ray tracing numbers (including fresnel terms and raw polarization values).
We rounded out analysis functions by adding PSF (Geometric and Huygens, GPU Accelerated!), MTF and OPD measurement functions.
A couple of marquee features this release - the main being CLI routines for tolerancing:
Find Manufacturing Tolerances Using Inverse Sensitivity Analysis

Improve Manufacturing Yield Using Monte Carlo Analysis

And the second is the ability to simulate eSFR and Color checker test charts as seen through an optical system.


These charts leverage the established Image Processing Toolbox functions to measure sharpness and color. The main function to create these, renderChart, can leverage the GPU and has various parameters to control the positioning of the chart. The GPU acceleration is important since this does the full Monte Carlo ray trace of the scene.
We also have a whole bunch of featured examples! Not only do these help us dog food and validate our API designs, it also helps us show you what is possible. If any of these resonate, let us know - that would motivate us to fold these in as first class API's with potentially better (tailored) performance.
For example 😄, the inbuilt chart rendering function mentioned above work on an internal parametric chart model so it cannot be used to render arbitrary images. However, we can simulate a user image using spatially varying PSFs - shown here: Simulate Image Using Spatially Variant PSF. This is much faster than a full ray render like the charts.

This one shows off both the Grid surface and OPD functionality: Model Shack-Hartmann Wavefront Sensor

And if you use Simulink based control systems, we show you a way to model dynamic systems with feedback control! Model Dynamic Optical Systems with Scanning Elements shows an f-theta scanning system controlled by a Simulink model.

Finally, something I really enjoyed learning about and putting together - a set of examples modelling the human eye.
Create Human Eye Model Schematic
Model Human Eye Diopters, Accommodation, and Refractive Errors
Simulate Human Eye Changes with Age
Model Progressive Addition Lens Using Presbyopic Eye Model

Kick the tires with a trial license, or if you already have 26b with the Image Processing Toolbox, get this free optics add-on.
Let us know what you think!
If you have a must-have workflow, share it in the comments.
If its doable, I'll let you know and if not ... I'll let the team know 😄!
2
2
u/Thick-Panic6683 7d ago
The mathworks page shows a 3D view of an optical system. Is it possible to do non-sequential modeling with ray trace and light scattering simulation, like Zemax? Seems like it would be within reach if you don't already have it.
3
u/BlueHash4 6d ago
Not in R2026b. Our current aim is to build a solid foundation first and then depending on user requests, evolve.
Would you mind outlining a few usecases? I frequently see two definitions of non-sequential - one feels truly 'non-sequential', like illumination/lighting for designing things like automotive light housings. And another, feels a bit like 'multi sequential', i.e think of a laser system with beam splitters and multiple detectors. The latter feels more like a deterministic set of sequential systems, with only the initial step of determining these sub-systems needing a true non-sequential trace.
3
u/Thick-Panic6683 6d ago edited 6d ago
I have used non-sequential mode for illumination visualization as well as laser system analysis through mirror arrangements. I would set up detector screens to capture light scattering hits on the detector. From this would make animations by moving components in 3D and capturing the detector screens. Also used merit functions to walk a laser beam to a detector point. One utility I wrote in Matlab used the keyboard arrow keys to walk laser beams through mirror combinations.
But often I used it to visualize 3D optical systems from CAD models for marketing and proposal work. What I am thinking is a CAD geometry kernal that imports STEP/STL optical component models and runs a ray trace through that to produce good graphics. I have considerd possible open-source solutions. (this is almost just an intellectual exercise as the level of effort exceeeds the possible user base).
I posed the questions to Chat GPT given your toolkit and available geometry engines for Matlab. The OpenCascade kernel may be an option for you to consider. I can share that chat with you by DM if you are interested. It provides an architecture for how that could be achieved and level of effort required.
1
u/BlueHash4 6d ago
I would be interested in workflows/usecases for sure! Especially the laser system analysis. Feel free to DM.
2
u/Thick-Panic6683 6d ago
I DM'd the chatgpt thread. My laser analysis was often very simplistic; just visualize where the beam is hitting after encountering mirrors and other components. I would build a 3D model in Zemax (by importing CAD STEP files) and use whatever sources might approximate the laser. In my work I encountered engineers developing industrial laser welding/cutting systems who had no background in optical layout and modeling.
1
u/Equivalent_Bridge480 6d ago
stray light
1
u/BlueHash4 6d ago
Thank you! What would you consider is the current 'best approach' for stray light analysis? Do you use any particular tool that is well suited for it now?
1
u/Equivalent_Bridge480 6d ago
Not sure what mean best approach. Each system and engineer have own best way. And probably noone will share spmething important with competitoers and llm which collect data from reddit for *0 m dollars per year.
I using zemax. And if your question what is problems with it - zemax dont convert nsc to sc.
2
u/BlueHash4 5d ago
I understand what you mean. Thanks for sharing the nsc->sc pain.
I think MATLAB is well suited here in the sense that you would (eventually) have all the basic blocks (even beyond optics!) - so each expert could put together/experiment with their own unique workflows.
1
2
u/lancerusso 6d ago
Can it read in CODE V files (.SEQ) yet?
5
u/BlueHash4 6d ago
Not yet.
We currently support ZMX import, mainly because we had access to known good designs so we could validate the import process. Its not an explicitly defined format, so we could still be missing edge cases!
We have some customers asking us for .SEQ import - but we dont yet have enough samples to be confident we understand the format. Open to suggestions if you have references! Or DM me and we can connect officially if you are in a position to share.
3
u/lancerusso 6d ago
Particularly interesting is use of INT (interferogram (usually zernike) on a surface), which is how CODE V does tolerancing these days.
CODE V documents most (if not all) of the .SEQ commands. SEQ is a sequential command file used to reconstruct a system design, so it should be easier than e.g. a closed source binary file that stores a design.
3
1
u/nian2326076 6d ago
That's awesome that R2026b is adding more to the biconic and grid surface specs. If you're getting ready for interviews or just want to talk about this in a technical setting, focus on how these new features can solve real-world problems in optical system design. Make sure you know the practical uses and limits of these specs. For interviews, it might help to talk about how you've used these tools in past projects or plan to use them in the future. If you need more detailed interview prep, I've found PracHub helpful for brushing up on technical concepts. Good luck!
3
u/Equivalent_Bridge480 7d ago
what price of matlab + Simulink for running this toolbox?
how you verified if software correct?