Difference between revisions of "Fdweights.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Created page with "Calculates finite difference weights for numerical derivatives (including order 0, which amounts to interpolation). Syntax: w=fdweights(target_point,grid_points,max_...")
 
(Update function See also links and function index membership)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
−
Calculates finite difference weights for numerical derivatives (including order 0, which amounts to interpolation). Syntax:
+
{{DISPLAYTITLE:fdweights.m}} __NOTOC__
 +
Calculates finite difference weights for numerical derivatives, including order 0, which amounts to interpolation.
  
−
        w=fdweights(target_point,grid_points,max_order)
+
==Syntax==
  
−
Parameters:
+
      w=fdweights(target_point,grid_points,max_order)
  
−
  target_point - the point at which the derivative is required
+
==Parameters==
  
−
  grid_points  - the points at which the function is given
+
    target_point - the point at which the derivative
 +
                    is required
 +
 +
    grid_points  - the points at which the function  
 +
                    is given
 +
 +
    max_order    - maximum derivative order
  
−
  max_order    - maximum derivative order
+
==Outputs==
  
−
The function returns finite difference coefficient array with the coefficients for the successive derivatives in rows.
+
    w            - finite difference coefficient array
 +
                    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==
 +
[[fdmat.m]], [[fdlap.m]], [[fdhess.m]], [[fdkup.m]], [[fdvec.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]]''

Latest revision as of 18:36, 6 June 2026

Calculates finite difference weights for numerical derivatives, including order 0, which amounts to interpolation.

Syntax

     w=fdweights(target_point,grid_points,max_order)

Parameters

    target_point - the point at which the derivative 
                   is required

    grid_points  - the points at which the function 
                   is given

    max_order    - maximum derivative order

Outputs

    w            - finite difference coefficient array
                   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

fdmat.m, fdlap.m, fdhess.m, fdkup.m, fdvec.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