メインコンテンツ

applyPerturbation

R2026b

Apply perturbation from sensitivity or tolerance analysis results

Since R2026b

    Description

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

    [sysMin,sysMax] = applyPerturbation(sensitivityResult,rowIdx) reconstructs the perturbed optical systems at the minimum and maximum tolerance limits corresponding to the specified row rowIdx in the sensitivity results table. To use this syntax, you must specify result as an OpticalSensitivity object.

    [sysMin,sysMax] = applyPerturbation(sensitivityResult,rowIdx,CompensatorApplied=compensatorApplied) applies the compensator adjustments computed during the sensitivity analysis. This syntax also requires the Optimization Toolbox™.

    example

    newopsys = applyPerturbation(toleranceResult,rowIdx) reconstructs the perturbed optical system from the specified Monte Carlo trial. To use this syntax, you must specify result as an OpticalTolerance object.

    newopsys = applyPerturbation(toleranceResult,rowIdx,CompensatorApplied=compensatorApplied) applies the compensator adjustments computed during the tolerance analysis. This syntax also requires the Optimization Toolbox.

    example

    Examples

    collapse all

    Import an optical system into the workspace.

    opsys = zmximport("PhotographicLens.zmx");

    Create an optical tolerance set with a tolerance for the radius of curvature of surfaces.

    tolSet = opticalToleranceSet;
    tolSet = addSurfaceRadiusTolerance(tolSet,0.05);

    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 tolerance.

    resultSensitivity = opticalSensitivity(opsys,meritFcn,tolSet);

    Perturb the optical system by using the 16th tolerance-target combination.

    idx = 16;
    [sysMinComp,sysMaxComp] = applyPerturbation(resultSensitivity,idx,CompensatorApplied=false);

    Evaluate the merit function of the perturbed optical system at the minimum and maximum tolerance limits. Observe that these metric scores match the metric scores in the results of the original sensitivity analysis.

    evaluate(meritFcn,sysMinComp)
    ans = 
    0.0069
    
    evaluate(meritFcn,sysMaxComp)
    ans = 
    0.0085
    
    resultSensitivity.ResultTable.MetricScore{idx}
    ans = 1×2 cell array
        {[0.0069]}    {[0.0085]}
    
    

    Import an optical system into the workspace.

    opsys = zmximport("DoubleGaussLens.zmx");

    Create an optical tolerance set with a tolerance for the radius of curvature of surfaces.

    tolSet = opticalToleranceSet;
    tolSet = addSurfaceConicConstantTolerance(tolSet,0.07);

    Create a merit function object for evaluating system performance.

    meritFcn = opticalMeritFunction;
    meritFcn = addSpot(meritFcn);

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

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

    Perturb the optical system using the results from the 12th Monte Carlo trial.

    idx = 12;
    newopsys = applyPerturbation(resultTolerance,idx,CompensatorApplied=false);

    Evaluate the merit function of the perturbed optical system, and observe that the metric score and the raw metric value match the merit score and raw metric value in the results.

    [score,rawValue] = evaluate(meritFcn,newopsys)
    score = 
    0.0557
    
    rawValue = 
    0.0557
    
    resultTolerance.MeritScore(idx)
    ans = 
    0.0557
    
    resultTolerance.ResultTable.Metric(idx)
    ans = 
    0.0557
    

    Input Arguments

    collapse all

    Sensitivity analysis result object, specified as an OpticalSensitivity object.

    Tolerance analysis result object, specified as an OpticalTolerance object.

    Row index of the result table, specified as a positive integer.

    • For sensitivity results, each row in the result table corresponds to a tolerance and target combination. Select a row index that corresponds to a specific tolerance and target combination. For example, the combination having maximum sensitivity.

    • For tolerance results, each row corresponds to a Monte Carlo trial. Select a row corresponding to a specific Monte Carlo trial. For example, the worst-performing trial.

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

    Compensator application, specified as a logical 1(true) or 0(false). Specify compensatorApplied as true to include compensator adjustments in the reconstructed system. To use the compensator, you require the Optimization Toolbox. If you specify this argument as true and no compensator was used during the analysis, the function returns an error.

    Data Types: logical

    Output Arguments

    collapse all

    Minimum perturbation system, returned as an opticalSystem object representing the optical system with the minimum tolerance limit perturbation applied. The function returns this output when the input is an OpticalSensitivity object.

    Maximum perturbation system, returned as an opticalSystem object representing the optical system with the maximum tolerance limit perturbation applied. The function returns this output when the input is an OpticalSensitivity object.

    Perturbed system, returned as an opticalSystem object representing the optical system with all perturbations from the specified Monte Carlo trial applied. The function returns this output when the input is an OpticalTolerance object.

    Version History

    Introduced in R2026b