メインコンテンツ

opd

R2026b

Optical path difference for optical system

Since R2026b

Description

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

opdr = opd(opsys) computes the optical path difference (OPD) and optical path length (OPL) for the optical system opsys using all points and wavelengths in the optical system.

example

opdr = opd(opsys,Name=Value) computes the OPD using additional options specified by one or more name-value arguments. For example, Wavelengths=[440 537 612] specifies the wavelengths at which to compute the OPD as 440, 537, and 612 nm.

opdr = opd(opsys,rayBundle) computes the OPD using the existing traced ray data in rayBundle, instead of tracing new rays through the system.

example

Examples

collapse all

Create an optical system.

opsys = opticalSystem;
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)
addGap(opsys,2.75)
addImageSensor(opsys)

Display the optical system in 2-D.

view2d(opsys);

Figure contains an object of type optics.ui.opticalsystemviewer2d. The chart of type optics.ui.opticalsystemviewer2d has title Optical System.

Compute the optical path difference (OPD).

opdr = opd(opsys);

Display the OPD results as a fan chart.

hfan = show(opdr);
title("Wavefront Error")

Figure contains an object of type optics.chart.opdfanchart. The chart of type optics.chart.opdfanchart has title Wavefront Error.

Import a double Gauss lens optical system from a ZMX file into the workspace.

opsys = zmximport("DoubleGaussLens.zmx");

Create a hexapolar sampling grid.

sg = samplingGrid("Hexapolar",30);

Trace rays through the optical system.

rb = traceRays(opsys,SamplingGrid=sg);

Compute the OPD using data from the ray bundle.

opdr = opd(opsys,rb);

Display the OPD results as a fan chart.

hfan = show(opdr,Legend="off");
title("Wavefront Error")

Figure contains an object of type optics.chart.opdfanchart. The chart of type optics.chart.opdfanchart has title Wavefront Error.

Input Arguments

collapse all

Optical system, specified as an opticalSystem object.

Traced ray data, specified as an array of RayBundle objects.

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: opdr = opd(opsys,Wavelengths=[440 537 612]) specifies the wavelengths at which to compute the OPD as 440, 537, and 612 nm.

Field points for OPD computation, specified as one of these options:

FieldPoints ValueLight Source Type

Array of FieldAngle objects

Field points represent light sources that are at an infinite distance from the first surface of the optical system.

Array of FieldPosition objects

Field points represent light sources that are at a finite distance from the first surface of the optical system.
Array of FieldPosition and FieldAngle objectsField points represent two types of light sources, either at an infinite distance or at a finite distance from the first surface of the optical system.

Wavelengths for OPD computation, specified as an M-element numeric vector. M is the number of wavelengths. Each element of the vector is a wavelength, in nanometers.

Data Types: double

Sampling grid for tracing rays through the entrance pupil, specified as a samplingGrid object. The sampling grid contains the normalized coordinates at which opd samples the entrance pupil for ray tracing.

Output Arguments

collapse all

OPD results, returned as an N-by-M matrix of OPD objects. N is the number of specified field points, and M is the number of specified wavelengths. Each OPD object contains the optical path difference, optical path length measurements, and other associated information for a single field point and wavelength.

When you specify the rayBundle argument, opdr has the same dimensions as rayBundle.

Note

The OpticalPathDifference and OpticalPathLength properties of each OPD object are in millimeters, while the RMS and PeakToValley properties are in waves. To convert millimeter values to waves, divide by the wavelength in millimeters (Wavelength * 1e-6).

Version History

Introduced in R2026b