TEST_APPROX
Test Data for Approximation Algorithms
TEST_APPROX
is a MATLAB library which
provides sets of test data for approximation algorithms.
TEST_APPROX contains a number of vectors of data (X(1:N),Y(1:N))
for which no underlying functional relationship is given.
The task of interpolation software is to find, from some given
class of functions, the function G(X) which exactly matches the
known data values. That is, G(X(1:N)) = Y(1:N).
The task of approximation software is to find, from some given
class of functions, the function H(X) for which some approximation
error is minimized. There are many forms of error measurement.
For instance, the error might simply be the sum of the differences
of the function and the data at the data abscissas:
l1(X) = sum ( 1 <= I <= N ) abs ( H(X(I)) - Y(I) )
or the square root of the sum of squares
l2(X) = sqrt ( sum ( 1 <= I <= N ) ( H(X(I)) - Y(I) )^2 )
or the maximum pointwise error:
l_inf(X) = max ( abs ( H(X(I)) - Y(I) ) )
In cases where a functional form is given, the error might be
measured in terms of the integral of the absolute value of the
difference over some interval:
L1(X,A,B) = integral ( A <= X <= B ) abs ( H(X) - F(X) ) dx
and so on.
The problems available include:
-
p01_data.png: DeBoor example, Mars position data
-
p02_data.png: DeBoor example, roughly linear data
-
p03_data.png: The pulse data, 0 0 0 0 0 1 0 0 0 0 0;
-
p04_data.png: The jump data, 0 0 0 0 0 1/2 1 1 1 1 1;
-
p05_data.png: DeBoor's Titanium Property data;
-
p06_data.png: The Sawtooth data;
-
p07_data.png: Concavity test data;
-
p08_data.png: Extrapolation test data;
-
p09_data.png: Sunspot data, 1700-1960;
-
p10_data.png: 100 samples of y=2+5x+10*N(0,1),
where N(0,1) is a random normal value with 0 mean and unit variance;
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
TEST_APPROX is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
BERNSTEIN,
a MATLAB library which
evaluates the Bernstein polynomials,
useful for uniform approximation of functions;
CHEBYSHEV,
a MATLAB library which
computes the Chebyshev interpolant/approximant to a given function
over an interval.
LAGRANGE_APPROX_1D,
a MATLAB library which
defines and evaluates the Lagrange polynomial p(x) of degree m
which approximates a set of nd data points (x(i),y(i)).
PWL_APPROX_1D,
a MATLAB library which
approximates a set of data using a piecewise linear function.
SPLINE,
a MATLAB library which
includes many routines to construct and evaluate spline
interpolants and approximants.
TEST_APPROX,
a dataset directory which
contains sets of data (x,y) for which an approximating formula is desired.
TEST_INTERP,
a MATLAB library which
defines a number of test problems for interpolation,
provided as a set of (x,y) data.
TEST_INTERP_1D,
a MATLAB library which
defines test problems for interpolation of data y(x),
depending on a 1D argument.
VANDERMONDE_APPROX_1D,
a MATLAB library which
finds a polynomial approximant to a function of 1D data
by setting up and solving an overdetermined linear system for the polynomial coefficients,
involving the Vandermonde matrix.
Reference:
-
Samuel Conte, Carl deBoor,
Elementary Numerical Analysis,
Second Edition,
McGraw Hill, 1972,
ISBN: 07-012446-4,
LC: QA297.C65.
-
Carl deBoor,
A Practical Guide to Splines,
Springer, 2001,
ISBN: 0387953663,
LC: QA1.A647.v27.
-
Max Waldmeier,
The Sunspot-Activity in the Years 1610-1960,
Shulthess, 1961,
LC: QB525.W34.
Source Code:
-
p00_dat.m,
returns the data vector for any problem.
-
p00_data_num.m,
returns the dimension of the data vector for any problem.
-
p00_data_plot.m,
plots the data.
-
p00_prob_num.m,
returns the number of test problems.
-
p00_story.m,
prints the "story" for any problem.
-
p00_title.m,
returns the title of any problem.
-
p01_dat.m,
returns the data vector for problem 1.
-
p01_data_num.m,
returns the dimension of the data vector for problem 1.
-
p01_story.m,
prints the "story" for problem 1.
-
p01_title.m,
returns the title of problem 1.
-
p02_dat.m,
returns the data vector for problem 2.
-
p02_data_num.m,
returns the dimension of the data vector for problem 2.
-
p02_story.m,
prints the "story" for problem 2.
-
p02_title.m,
returns the title of problem 2.
-
p03_dat.m,
returns the data vector for problem 3.
-
p03_data_num.m,
returns the dimension of the data vector for problem 3.
-
p03_story.m,
prints the "story" for problem 3.
-
p03_title.m,
returns the title of problem 3.
-
p04_dat.m,
returns the data vector for problem 4.
-
p04_data_num.m,
returns the dimension of the data vector for problem 4.
-
p04_story.m,
prints the "story" for problem 4.
-
p04_title.m,
returns the title of problem 4.
-
p05_dat.m,
returns the data vector for problem 5.
-
p05_data_num.m,
returns the dimension of the data vector for problem 5.
-
p05_story.m,
prints the "story" for problem 5.
-
p05_title.m,
returns the title of problem 5.
-
p06_dat.m,
returns the data vector for problem 6.
-
p06_data_num.m,
returns the dimension of the data vector for problem 6.
-
p06_story.m,
prints the "story" for problem 6.
-
p06_title.m,
returns the title of problem 6.
-
p07_dat.m,
returns the data vector for problem 7.
-
p07_data_num.m,
returns the dimension of the data vector for problem 7.
-
p07_story.m,
prints the "story" for problem 7.
-
p07_title.m,
returns the title of problem 7.
-
p08_dat.m,
returns the data vector for problem 8.
-
p08_data_num.m,
returns the dimension of the data vector for problem 8.
-
p08_story.m,
prints the "story" for problem 8.
-
p08_title.m,
returns the title of problem 8.
-
p09_dat.m,
returns the data vector for problem 9.
-
p09_data_num.m,
returns the dimension of the data vector for problem 9.
-
p09_story.m,
prints the "story" for problem 9.
-
p09_title.m,
returns the title of problem 9.
-
p10_dat.m,
returns the data vector for problem 10.
-
p10_data_num.m,
returns the dimension of the data vector for problem 10.
-
p10_story.m,
prints the "story" for problem 10.
-
p10_title.m,
returns the title of problem 10.
-
r8vec2_print.m,
prints an R8VEC2.
-
r8vec2_write.m,
writes an R8VEC2 to a file.
-
timestamp.m,
prints the current date as a timestamp.
Examples and Tests:
-
test_approx_test.m, the
calling program;
-
test_approx_test01.m,
shows how P00_TITLE can be called.
-
test_approx_test02.m,
shows how P00_STORY can be called.
-
test_approx_test03.m,
uses polynomial interpolation on data vector problems.
-
test_approx_test04.m,
uses linear spline interpolation on all problems.
-
test_approx_test05.m,
uses Overhauser spline interpolation on all problems.
-
test_approx_test06.m,
uses cubic spline interpolation on all problems.
-
test_approx_test07.m,
plots an Overhauser spline interpolant for problem 7.
-
test_approx_test08.m,
plots a cubic spline interpolant for problem 7.
-
test_approx_test09.m,
uses B spline approximation on all problems.
-
test_approx_test10.m,
plots a B spline approximant for problem 7.
-
test_approx_test11.m,
plots a beta spline approximant for problem 7.
-
test_approx_test12.m,
plots a Bernstein spline approximant for problem 7.
-
test_approx_test13.m,
plots a cubic spline interpolant for problem 5.
-
test_approx_test_output.txt, the sample
output.
TEST07 creates data files for an Overhauser spline interpolant
to data set 7.
TEST08 creates data files for a cubic spline interpolant
to data set 7.
TEST10 creates data files for a B-spline approximant
to data set 7.
TEST11 creates data files for a beta spline approximant to
data set 7:
TEST12 creates data files for a Bernstein approximant
to data set 5.
TEST13 creates data files for a cubic spline interpolant
to data set 5.
You can go up one level to
the MATLAB source codes.
Last revised on 06 February 2012.