MATLAB Functions Help Desk

del2

Purpose

Discrete Laplacian

Syntax

Definition

If the matrix U is regarded as a function u(x,y) evaluated at the point on a square grid, then 4*del2(U) is a finite difference approximation of Laplace's differential operator applied to u, that is

:

where

:

in the interior. On the edges, the same formula is applied to a cubic extrapolation.

For functions of more variables u(x,y,z,...), del2(U) is an approximation,

where N is the number of variables in u.

Description

L = del2(U) where U is a rectangular array is a discrete approximation of

The matrix L is the same size as U with each element equal to the difference between an element of U and the average of its four neighbors.

L = del2(U) when U is an multidimensional array, returns an approximation of

where N is ndims(u).

L = del2(U,h) where H is a scalar uses H as the spacing between points in each direction (h=1 by default).

L = del2(U,hx,hy) when U is a rectangular array, uses the spacing specified by hx and hy. If hx is a scalar, it gives the spacing between points in the x-direction. If hx is a vector, it must be of length size(u,2) and specifies the x-coordinates of the points. Similarly, if hy is a scalar, it gives the spacing between points in the y-direction. If hy is a vector, it must be of length size(u,1) and specifies the y-coordinates of the points.

L = del2(U,hx,hy,hz,...) where U is multidimensional uses the spacing given by hx, hy, hz, ...

Examples

The function

has

For this function, 4*del2(U) is also 4.

See Also

diff        Differences and approximate derivatives

gradient    Numerical gradient



[ Previous | Help Desk | Next ]