Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Discrete Laplacian

`L = del2(U)`

`L = del2(U,h)`

`L = del2(U,hx,hy,...,hN)`

returns
a discrete approximation of Laplace’s differential
operator applied to `L`

= del2(`U`

)`U`

using the default
spacing, `h = 1`

, between all points.

specifies the spacing `L`

= del2(`U`

,`hx,hy,...,hN`

)`hx,hy,...,hN`

between points in each
dimension of `U`

. Specify each spacing input as a scalar or a
vector of coordinates. The number of spacing inputs must equal the number of
dimensions in `U`

.

The first spacing value

`hx`

specifies the*x*-spacing (as a scalar) or*x*-coordinates (as a vector) of the points. If it is a vector, its length must be equal to`size(U,2)`

.The second spacing value

`hy`

specifies the*y*-spacing (as a scalar) or*y*-coordinates (as a vector) of the points. If it is a vector, its length must be equal to`size(U,1)`

.All other spacing values specify the spacing (as scalars) or coordinates (as vectors) of the points in the corresponding dimension in

`U`

. If, for`n > 2`

, the`n`

th spacing input is a vector, then its length must be equal to`size(U,n)`

.

If the input `U`

is a matrix, the interior
points of `L`

are found by taking the difference
between a point in `U`

and the average of its four
neighbors:

$${L}_{ij}=\left[\frac{\left({u}_{i+1,j}+{u}_{i-1,j}+{u}_{i,j+1}+{u}_{i,j-1}\right)}{4}-{u}_{i,j}\right]\text{\hspace{0.17em}}.$$

Then, `del2`

calculates the values on the edges
of `L`

by linearly extrapolating the second differences
from the interior. This formula is extended for multidimensional `U`

.