主要内容

Tolerance

R2026b

Optical tolerance

Since R2026b

    Description

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

    Tolerances for sensitivity and Monte Carlo analysis of optical system.

    Creation

    Create a collection of optical tolerances using the opticalToleranceSet function. The opticalToleranceSet function creates a 1-by-n array of Tolerance objects. Each element in the array is an object of one of these types of tolerance classes.

    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);

    Version History

    Introduced in R2026b