Fdlap.m

From Spinach Documentation Wiki
Jump to: navigation, search

Returns a finite-difference representation of the Laplacian for a 3D array with a user-specified finite difference stencil size. The re- sulting operator is a sparse matrix designed to act on the vectorization of the 3D array. The dimensions of the 3D array are assumed to be ordered as [X Y Z]. Syntax:

                   L=fdlap(npoints,extents,nstenc)

The following parameters are needed:

    npoints -  a three-element vector specifying the number of
               discretization points in each dimension of the
               3D cube of data that the operator will be acting
               on, ordered as [X Y Z].
    extents -  a three-element vector specifying axis extents,
               ordered as [X Y Z].
    nstenc  -  number of finite-difference stencil points for
               the finite-difference approximations.

The resulting operator is a sparse matrix designed to act on the vectorization of rho. The dimensions of rho are assumed to be ordered as [X Y Z].

Note: Dirichlet boundary conditions - the resulting Laplacian should only be used for the inverse Laplacian operation.