hermite_cubic, a MATLAB code which demonstrates the use of cubic polynomials in the Hermite form.
The Hermite form of a cubic polynomial defines the polynomial p(x) by specifying two distinct points x1 and x2, and providing values for the following four items:
f1 = p(x1) d1 = p'(x1) f2 = p(x2) d2 = p'(x2)The locations of the abscissas and the four data values are enough to uniquely define a cubic polynomial, known as the Hermite cubic.
From the Hermite cubic representation, it is possible to determine the standard power series form:
p(x) = c0 + c1 * x + c2 * x2 + c3 * x3
It is possible, given any value of the argument x and the data values that define the Hermite cubic polynomial, to determine the value of p(x), as well as the values of the first, second and third derivatives.
It is possible, given two values of the argument x3 and x4, and the data values that define the Hermite cubic polynomial, to determine the value of the integral of p(x) over the interval [x3,x4].
A sequence of Hermite cubic polynomials can be used to produce a piecewise cubic Hermite interpolant, if we are given a strictly increasing sequence of n nodes x(1:n), and corresponding data vectors f(1:n) and d(1:n). This is done by defining n-1 cubic Hermite polynomials, with the i-th polynomial defined using the data at nodes x(i) and x(i+1). The resulting function interpolates the value and derivative data, and is continuous and continuously differentiable everywhere, and in particular, at the nodes.
The computer code and data files described and made available on this web page are distributed under the MIT license
hermite_cubic is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.
bernstein_polynomial, a MATLAB code which evaluates the Bernstein polynomials, useful for uniform approximation of functions;
divdif, a MATLAB code which computes divided difference polynomials from data;
hermite_interpolant, a MATLAB code which computes the Hermite interpolant, a polynomial that matches function values and derivatives.
spline, a MATLAB code which includes many routines to construct and evaluate spline interpolants and approximants.
test_interp_1d, a MATLAB code which defines test problems for interpolation of data y(x), depending on a 1D argument.