Difference between revisions of "Fdvec.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Update function See also links and function index membership)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
−
{{DISPLAYTITLE:fdvec.m}}
+
{{DISPLAYTITLE:fdvec.m}} __NOTOC__
−
Calculates finite difference weights for numerical derivatives, including order 0, which amounts to interpolation.
+
Performs arbitrary-order finite-difference differentiation of a user-supplied row or column vector. Uses central finite-difference stencils in the middle and sided stencils of the same order of accuracy on the sides.
  
 
==Syntax==
 
==Syntax==
  
−
      w=fdweights(target_point,grid_points,max_order)
+
    dx=fdvec(x,npoints,order)
  
−
==Arguments==
+
==Parameters==
  
−
    target_point - the point at which the derivative
+
    x      - column or row vector to be differentiated
−
                    is required
 
 
   
 
   
−
    grid_points  - the points at which the function
+
    npoints - number of points in the finite difference
−
                    is given
+
              stencil
 
   
 
   
−
    max_order    - maximum derivative order
+
    order  - order of the derivative required
  
 
==Outputs==
 
==Outputs==
  
−
     w            - finite difference coefficient array
+
    dx     - column or row vector with the derivative
−
                    with the coefficients for the succes-
 
−
                    sive derivatives in rows
 
−
 
 
−
==Examples==
 
−
Point weights for central schemes on a three-point stencil, where the value is required at the centre:
 
−
 
 
−
  >> fdweights(0,[-1 0 1],2)
 
−
 
−
  ans =
 
−
 
 
−
          0    1.0000        0
 
−
    -0.5000        0    0.5000
 
−
      1.0000  -2.0000    1.0000
 
−
 
 
−
The three rows are for interpolation, first derivative and second derivative respectively.
 
  
 
==See also==
 
==See also==
−
[[fdmat.m]], [[fdlap.m]], [[fdhess.m]], [[fdkup.m]], [[fdweights.m]], [[fftdiff.m]], [[fourdif.m]], [[fourlap.m]]
+
[[fdmat.m]], [[fdlap.m]], [[fdhess.m]], [[fdkup.m]], [[fdweights.m]], [[fftdiff.m]], [[fourdif.m]], [[fourlap.m]], [[cgsppm2ang.m]], [[corrfun.m]], [[fpl2phan.m]], [[fpl2rho.m]], [[hydrodynamics.m]], [[interpmat.m]], [[oscillator.m]], [[overwound.m]], [[phan2fpl.m]], [[points2mult.m]], [[qform2sph.m]], [[qxspen_kernel.m]], [[spden.m]], [[Hyperfine_shift_module]], [[Kernel_utilities]]
−
 
 
  
−
''Version 2.2, authors: Bengt Fornberg, [[Ilya Kuprov]]''
+
''Version 2.2, authors: [[Ilya Kuprov]]''

Latest revision as of 19:36, 6 June 2026

Performs arbitrary-order finite-difference differentiation of a user-supplied row or column vector. Uses central finite-difference stencils in the middle and sided stencils of the same order of accuracy on the sides.

Syntax

    dx=fdvec(x,npoints,order)

Parameters

   x       - column or row vector to be differentiated

   npoints - number of points in the finite difference
             stencil

   order   - order of the derivative required

Outputs

   dx      - column or row vector with the derivative

See also

fdmat.m, fdlap.m, fdhess.m, fdkup.m, fdweights.m, fftdiff.m, fourdif.m, fourlap.m, cgsppm2ang.m, corrfun.m, fpl2phan.m, fpl2rho.m, hydrodynamics.m, interpmat.m, oscillator.m, overwound.m, phan2fpl.m, points2mult.m, qform2sph.m, qxspen_kernel.m, spden.m, Hyperfine_shift_module, Kernel_utilities

Version 2.2, authors: Ilya Kuprov