The symbolic calculation method is used here as the true value, although both the analytical expression and the symbolic calculation methods are exact and should, therefore, provide the same results up to 16 digits (the default precision of Matlab) other than for rounding errors.
![matlab symbolic toolbox gradient matrix matlab symbolic toolbox gradient matrix](https://cdn.educba.com/academy/wp-content/uploads/2020/07/jacobian-matlab-output-1.png)
Here we compare the formulae derived in the previous section for calculating such average gradients against alternative methods in two simulated SHWSs with 100% fill factor square lenslets, with 7 and 23 fully illuminated lenslets across the pupil. The wavefront can then be estimated by fitting the measured slopes to the calculated slopes due to a linear combination of basis functions such as the Zernike polynomials. In the SHWS, each uniformly illuminated lenslet forms an image onto a pixelated sensor that shifts relative to a reference position, proportionally to the average wavefront slope over the lenslet area. Finally, we show that the expressions derived here provide fastest calculation time and highest accuracy.Ħ. Application example: The Shack-Hartmann wavefront sensor Then, we use two-dimensional numerical integration of the Zernike slope over the subaperture areas, the one-dimensional numerical integration of the Zernike polynomials along the perimeter of the subapertures, and symbolic integration of Zernike polynomials along the perimeter of the subapertures. Second, the averaging of a discrete number of Zernike slope samples spread over the subaperture. First, the average Zernike slope over the entire aperture is approximated as the value at its center. The computing time and accuracy of the derived formulae are compared to the following alternative methods. Finally, and as a practical example, we use these formulae in a simulated SHWS with square lenslets. Then, a Cartesian expression for Zernike polynomials, modified from that by Carpio and Malacara, is integrated along line segments to derive a closed-form expression for the average slopes over polygonal areas. First, we show that the double integration needed to estimate the average Zernike slope over a subaperture can be reduced to a single integral of the Zernike itself along the subaperture perimeter. Here we derive formulae to evaluate the average Zernike gradients over polygonal subapertures, such as those found in the lenslet arrays of Shack-Hartmann wavefront sensors (SHWSs), which are typically square or hexagonal. When this approach is pursued, the fidelity with which a wavefront derived from slope sensor data can be described depends on the number of samples, the number of Zernike polynomials, and the errors in the calculation of their average slopes. The Zernike polynomials are the most commonly used basis functions due to their orthogonality over the unit circle which, by design, makes them convenient to describe rotationally symmetric optical systems. The latter, often used due to its robustness to noise, requires the estimation of average slopes of the basis functions over the sampling subapertures, which is the focus of this work.
![matlab symbolic toolbox gradient matrix matlab symbolic toolbox gradient matrix](https://www.researchgate.net/profile/Ali-Elham/publication/340687572/figure/fig3/AS:881289381040128@1587127170452/Drag-sensitivity-field-of-a-circular-staggered-fin-array-at-Re-40-Red-contour.png)
The wavefront is then estimated either by solving a set of discrete difference equations (zonal reconstruction) or by fitting the data to a linear combination of basis functions (modal reconstruction). These sensors measure wavefront slopes averaged over a set of non-overlapping discrete regions or subapertures. Slope wavefront sensors, such as the Shack-Hartmann, are widely used in medical, scientific, and industrial applications, including autorefraction and clinical aberrometry, refractive surgery, adaptive optics retinal imaging, visual psychophysics, vision simulators, microscopy, astronomy, line-of-sight communications, high power lasers and metrology.