Contenido principal

addSurfaceAsphericTolerance

R2026b

Add tolerance for surface aspheric coefficients

Since R2026b

    Description

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

    tolSet = addSurfaceAsphericTolerance(tolSet,value,coeffIdx) adds a tolerance for the aspheric coefficient at index coeffIdx to the tolerance set tolSet. By default, the tolerance applies to all top-level aspheric surfaces that have nonzero coefficients. The tolerance set, tolSet, is an opticalToleranceSet object. This function adds a SurfaceAsphericTolerance object to the Tolerances property of tolSet and appends the details of the tolerance to the ToleranceTable property of tolSet.

    example

    tolSet = addSurfaceAsphericTolerance(tolSet,value,coeffIdx,TargetIndex=targetIdx) applies the tolerance to only the surfaces specified by targetIdx. Use this syntax to target spherical surfaces or surfaces with all-zero coefficients, which are otherwise ignored.

    Examples

    collapse all

    Import an optical system into the workspace.

    opsys = zmximport("PhotographicLens.zmx");

    Create an empty optical tolerance set.

    tolSet = opticalToleranceSet;

    Add tolerances to the tolerance set.

    tolSet = addSurfaceRadiusTolerance(tolSet,0.05);
    tolSet = addSurfaceConicConstantTolerance(tolSet,[-0.01 0.01],TargetIndex=2);
    tolSet = addSurfacePositionTolerance(tolSet,PositionX=0.1);
    tolSet = addSurfaceTiltTolerance(tolSet,TiltX=[-0.5 0.5],TargetIndex=3);
    tolSet = addSurfaceAsphericTolerance(tolSet,0.05,4);
    tolSet = addComponentPositionTolerance(tolSet,PositionX=0.1);
    tolSet = addComponentTiltTolerance(tolSet,TiltY=[-0.2 0.2],TargetIndex=2:8);
    tolSet = addComponentMaterialTolerance(tolSet,Nd=0.05,TargetIndex=2:8);

    Inspect the tolerance set.

    tolSet
    tolSet = 
      opticalToleranceSet with properties:
    
            Tolerances: [1×8 optics.tolerance.Tolerance]
        ToleranceTable: [8×4 table]
    
    
    tolSet.Tolerances
    ans = 1×8 heterogeneous Tolerance (SurfaceRadiusTolerance, SurfaceConicConstantTolerance, SurfacePositionTolerance, ...) array with properties:
        ToleranceRange
        ToleranceType
    
    
    tolSet.ToleranceTable
    ans = 8×4 table
             TargetProperty     ToleranceRange    ToleranceType       TargetIndex   
             _______________    ______________    _____________    _________________
    
        1    "Radius"           -0.05     0.05    "Percentage"     {0×0 double     }
        2    "ConicConstant"    -0.01     0.01    "Absolute"       {[            2]}
        3    "PositionX"         -0.1      0.1    "Percentage"     {0×0 double     }
        4    "TiltX"             -0.5      0.5    "Absolute"       {[            3]}
        5    "Aspheric"         -0.05     0.05    "Percentage"     {0×0 double     }
        6    "PositionX"         -0.1      0.1    "Percentage"     {0×0 double     }
        7    "TiltY"             -0.2      0.2    "Absolute"       {[2 3 4 5 6 7 8]}
        8    "Nd"               -0.05     0.05    "Percentage"     {[2 3 4 5 6 7 8]}
    
    	Get insights using Copilot
    
    

    Create a merit function object for evaluating system performance.

    meritFcn = opticalMeritFunction;
    meritFcn = addSpot(meritFcn);

    Run a sensitivity analysis on the optical system using the merit function and tolerances.

    resultSensitivity = opticalSensitivity(opsys,meritFcn,tolSet);

    Run a Monte Carlo tolerance analysis with 100 trials on the optical system using the same merit function and tolerances.

    resultTolerance = opticalTolerance(opsys,meritFcn,tolSet,NumTrials=100);

    Input Arguments

    collapse all

    Tolerance set to which to add the tolerance, specified as an opticalToleranceSet object.

    Tolerance value, specified as a numeric scalar or a 1-by-2 numeric vector of the form [min max].

    • Scalar — Specifies a percentage tolerance relative to the nominal value. Percentage tolerances have no effect when the nominal value is zero.

    • 1-by-2 vector — Specifies an offset tolerance range [min max] relative to the nominal value.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Aspheric coefficient index to which to apply the tolerance, specified as a positive integer.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Surface indices to target, specified as a vector of positive integers. By default, the tolerance applies to all top-level surfaces. This function does not support tolerancing for surfaces of nested components.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Output Arguments

    collapse all

    Updated tolerance set, returned as an opticalToleranceSet object with the surface aspheric tolerance appended. This function adds a SurfaceAsphericTolerance object to the Tolerances property of tolSet and appends the details of the tolerance to the ToleranceTable property of tolSet.

    Version History

    Introduced in R2026b