主要内容

focus

Position image plane of optical system to minimize RMS spot size

Since R2026a

Description

Add-On Required: This feature requires the Optical Design and Simulation Library for Image Processing Toolbox add-on.

minSpot = focus(opsys) places the image plane at a position that minimizes the RMS spot size.

Note

This functionality requires the Optical Design and Simulation Library for Image Processing Toolbox™. You can install the Optical Design and Simulation Library for Image Processing Toolbox from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

example

minSpot = focus(opsys,Name=Value) specifies options using one or more name-value arguments. For example, Wavelengths=[455 678] places the image plane at a position that minimizes the RMS spot size at the 455 and 678 nanometer wavelengths.

Examples

collapse all

Create an empty optical system.

opsys = opticalSystem;

To create a doublet lens, add the three refractive surfaces of the doublet to the optical system using the addRefractiveSurface object function.

addRefractiveSurface(opsys,Radius=10,DistanceToNext=4,Material="N-BK7")
addRefractiveSurface(opsys,Radius=-10,DistanceToNext=2,Material="F2")
addRefractiveSurface(opsys,DistanceToNext=10)
addRefractiveSurface(opsys,Radius=10,DistanceToNext=4,Material="N-BK7")
addRefractiveSurface(opsys,Radius=-10)

Create a gap using the addGap object function, and add an image plane using the addImagePlane object function.

addGap(opsys,2)
addImagePlane(opsys)

Display a 2-D visualization of the initial optical system by using the view2d object function.

view2d(opsys,Title="Initial Doublet");

Figure contains an object of type optics.ui.opticalsystemviewer2d. The chart of type optics.ui.opticalsystemviewer2d has title Initial Doublet.

Create a copy of the initial optical system opsys.

opsys2 = copy(opsys);

Focus the copied optical system by shifting the image plane to a position where the RMS spot size is minimal. Display a 2-D visualization of the optical system by using the view2d object function. Trace rays and add them to the visualization using the addRays function.

sp = focus(opsys2);
hv = view2d(opsys2,Title="Focused Doublet");
addRays(hv)

Figure contains an object of type optics.ui.opticalsystemviewer2d. The chart of type optics.ui.opticalsystemviewer2d has title Focused Doublet.

Compute the spot diagram of the initial optical system and the spot diagram of the focused system by using the spot object function.

spotBefore = spot(opsys);
spotAfter = spot(opsys2);

Display the spot diagrams by using the spotDiagram object function.

spotDiagram(spotBefore,Title="Initial Spot");

Figure contains an object of type optics.chart.spotdiagram. The chart of type optics.chart.spotdiagram has title Initial Spot.

spotDiagram(spotAfter,Title="Focused Spot");

Figure contains an object of type optics.chart.spotdiagram. The chart of type optics.chart.spotdiagram has title Focused Spot.

Input Arguments

collapse all

Optical system to focus, specified as an opticalSystem object.

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: focus(Wavelengths=[455 678]) places the image plane at a position that minimizes the RMS spot size at the 455 and 678 nanometer wavelengths.

Field point from which to compute the spot distribution, specified as a FieldAngle object or a FieldPosition object.

FieldPoint valueField Point Type

FieldAngle object

Field point represents a light source that is at an infinite distance.

FieldPosition object

Field point represents a light source that is at a finite distance.

By default, the FieldPoint value is the first element of the FieldPoints property of the opticalSystem object opsys.

Wavelengths, in nanometers, for which to minimize the RMS spot size on the image plane, specified as an M-element numeric vector. M is the number of wavelengths.

Output Arguments

collapse all

Minimized RMS spot size, returned as a Spot object. Display the spot diagram using the spotDiagram function.

References

[1] #DevOptical Part 19: A Quick Focus Algorithm.” Accessed December 12, 2024. https://www.thepulsar.be/article/-devoptical-part-19--a-quick-focus-algorithm.

Version History

Introduced in R2026a