Contenuto principale

WavefrontRMS

R2026b

RMS wavefront error metric for optical system merit function

Since R2026b

Description

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

A WavefrontRMS object computes the weighted root-mean-square (RMS) wavefront error across specified field points and wavelengths for use in an optical system merit function. Evaluate the metric and compute the normalized residual score using the evaluateMetric object function.

Creation

There are two ways to create an WavefrontRMS object.

  • Use the addWavefrontRMS object function when you want to add this metric to an opticalMeritFunction object.

  • Use the optics.metric.WavefrontRMS function described here. Use this function when you want to create a RMS wavefront error metric without adding it to the optical merit function, or modify the properties of a RMS wavefront error metric already in the merit function. After creating the object, you can specify the RMS wavefront error properties by modifying the properties of the object.

Description

metric = optics.metric.WavefrontRMS creates a RMS wavefront error metric for use with the optical system merit function.

example

metric = optics.metric.WavefrontRMS(PropertyName=Value) sets writable properties using one or more name-value arguments. For example, Target=[0 0.1] specifies a target RMS wavefront error range of 0 to 0.1 waves.

Properties

expand all

Descriptive name for metric, specified as a string scalar.

Data Types: string

Target RMS wavefront error value, specified as a numeric scalar or 1-by-2 vector. The vector is of the form [lower, upper], where lower and upper are the lower and upper bounds of the target RMS wavefront error value, respectively. If you specify this argument as a scalar, the object considers the target metric as the upper bound. Units are in waves with respect to the primary wavelength of the optical system.

Data Types: double

Indices of wavelengths to evaluate, specified as a vector of positive integers. By default, the object computes the metric for all wavelengths in the optical system.

Data Types: double

Indices of field points to evaluate, specified as a vector of positive integers. By default, the object computes the metric for all field points in the optical system.

Data Types: double

Ray sampling pattern for RMS wavefront error computation, specified as a SamplingGrid object.

Object Functions

evaluateMetricEvaluate metric function

Examples

collapse all

Create an optical merit function.

mf = opticalMeritFunction;

To compute the RMS wavefront error metric, create a WavefrontRMS object.

RMSmetric = optics.metric.WavefrontRMS
RMSmetric = 
  WavefrontRMS with properties:

    WavelengthIndex: [1×0 double]
    FieldPointIndex: [1×0 double]
       SamplingGrid: [1×1 samplingGrid]
               Name: "Wavefront RMS"
             Target: [0 0]

Add the RMS wavefront error metric to the optical merit function by setting the Metrics property of the opticalMeritFunction object.

mf.Metrics = RMSmetric
mf = 
  opticalMeritFunction with properties:

         Metrics: [1×1 optics.metric.WavefrontRMS]
         Weights: 1
    MetricsTable: [1×4 table]

Algorithms

The WavefrontRMS metric computes the weighted root-mean-square (RMS) wavefront error across multiple field points and wavelengths using these steps.

  1. Compute the optical path difference (OPD) for each combination of field point and wavelength specified by the FieldPointIndex and WavelengthIndex properties. If either property is empty, all field points or wavelengths defined in the optical system are used.

  2. Extract the RMS wavefront error from each OPD result to form a NumFP-by-NumWL matrix of values in waves, where NumFP is the number of field points and NumWL is the number of wavelengths.

  3. Normalize the FieldPointWeights and WavelengthWeights vectors from the optical system so that each sums to 1.

  4. Form a combined weights matrix as the outer product of the normalized field point weights and wavelength weights:

    weights = wavelengthWeights.* fieldPointWeights'

    Each element w(i,j) represents the joint weight for field point i at wavelength j.

  5. Compute the weighted RMS wavefront error across all selected field point and wavelength combinations:

    RMS=i,jwij·rij2i,jwij

    where rij is the RMS wavefront error for field point i at wavelength j, and wij is the corresponding weight.

    The overall RMS wavefront metric value is the weighted RMS of the raw OPD RMS values:

    metricValue=i=1Nfpj=1Nwlwij·RMSij2i=1Nfpj=1Nwlwij

Version History

Introduced in R2026b