# Fdmat.m

From Spinach Documentation Wiki

Returns arbitrary-order central finite-difference differentiation matrix (sparse) with unit spacing and sided finite-difference schemes of the same order at the edges. Syntax:

D=fdmat(dim,npoints,order,boundary)

Parameters:

dim - dimension of the column vector to be differentiated

npoints - number of points in the finite diffe- rence stencil

order - order of the derivative required

boundary - 'wall' fills the edges with sided finite difference schemes, 'pbc' assumes periodic boundaries. The default is 'wall'.