comparison scripts/polynomial/unmkpp.m @ 5824:448f9982e7fb

[project @ 2006-05-19 06:53:31 by jwe]
author jwe
date Fri, 19 May 2006 06:53:31 +0000
parents
children 34f96dd5441b
comparison
equal deleted inserted replaced
5823:080c08b192d8 5824:448f9982e7fb
1 ## Copyright (C) 2000 Paul Kienzle
2 ##
3 ## This file is part of Octave.
4 ##
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9 ##
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, write to the Free
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301, USA.
19
20 ## -*- texinfo -*-
21 ## @deftypefn {Function File} {[@var{x}, @var{p}, @var{n}, @var{k}, @var{d}] =} unmkpp (@var{pp})
22 ##
23 ## Extract the components of a piece-wise polynomial structure @var{pp}.
24 ## These are as follows:
25 ##
26 ## @table @asis
27 ## @item @var{x}
28 ## Samples points.
29 ## @item @var{p}
30 ## Polynomial coefficients for points in sample interval. @code{@var{p}
31 ## (@var{i}, :)} contains the coefficients for the polynomial over
32 ## interval @var{i} ordered from highest to lowest. If @code{@var{d} >
33 ## 1}, @code{@var{p} (@var{r}, @var{i}, :)} contains the coeffients for
34 ## the r-th polynomial defined on interval @var{i}. However, this is
35 ## stored as a 2-D array such that @code{@var{c} = reshape (@var{p} (:,
36 ## @var{j}), @var{n}, @var{d})} gives @code{@var{c} (@var{i}, @var{r})}
37 ## is the j-th coefficient of the r-th polynomial over the i-th interval.
38 ## @item @var{n}
39 ## Number of polynomial pieces.
40 ## @item @var{k}
41 ## Order of the polynomial plus 1.
42 ## @item @var{d}
43 ## Number of polynomials defined for each interval.
44 ## @end table
45 ##
46 ## @seealso{mkpp, ppval, spline}
47 ## @end deftypefn
48
49 function [x, P, n, k, d] = unmkpp (pp)
50 if (nargin == 0)
51 usage ("[x, P, n, k, d] = unmkpp(pp)")
52 endif
53 if (! isstruct (pp))
54 error ("unmkpp: expecting piecewise polynomial structure");
55 endif
56 x = pp.x;
57 P = pp.P;
58 n = pp.n;
59 k = pp.k;
60 d = pp.d;
61 endfunction