fd=pderiv(f); fd=pderiv(f,dim); fd=pderiv(f,dim,difforder);
pderiv(f) will compute the derivative of f using a 4th order centered finite difference scheme. f must have been obtained by a regular sampling. If f is a matrix, the derivative along the columns will be found.
pderiv(f,dim) will do the same along dimension dim.
pderiv(f,dim,difforder) uses a centered finite difference scheme of order difforder instead of the default.
pderiv(f,dim,Inf) will compute the spectral derivative using a DFT.
pderiv assumes that f is a regular sampling of a function on the torus \([0,1)\). The derivative of a function on a general torus \([0,T)\) can be found by scaling the output by \(1/T\).