5824
|
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 |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
5824
|
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 |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
5824
|
18 |
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Function File} {[@var{x}, @var{p}, @var{n}, @var{k}, @var{d}] =} unmkpp (@var{pp}) |
|
21 ## |
|
22 ## Extract the components of a piece-wise polynomial structure @var{pp}. |
|
23 ## These are as follows: |
|
24 ## |
|
25 ## @table @asis |
|
26 ## @item @var{x} |
|
27 ## Samples points. |
|
28 ## @item @var{p} |
|
29 ## Polynomial coefficients for points in sample interval. @code{@var{p} |
|
30 ## (@var{i}, :)} contains the coefficients for the polynomial over |
|
31 ## interval @var{i} ordered from highest to lowest. If @code{@var{d} > |
7001
|
32 ## 1}, @code{@var{p} (@var{r}, @var{i}, :)} contains the coefficients for |
5824
|
33 ## the r-th polynomial defined on interval @var{i}. However, this is |
|
34 ## stored as a 2-D array such that @code{@var{c} = reshape (@var{p} (:, |
|
35 ## @var{j}), @var{n}, @var{d})} gives @code{@var{c} (@var{i}, @var{r})} |
|
36 ## is the j-th coefficient of the r-th polynomial over the i-th interval. |
|
37 ## @item @var{n} |
|
38 ## Number of polynomial pieces. |
|
39 ## @item @var{k} |
|
40 ## Order of the polynomial plus 1. |
|
41 ## @item @var{d} |
|
42 ## Number of polynomials defined for each interval. |
|
43 ## @end table |
|
44 ## |
|
45 ## @seealso{mkpp, ppval, spline} |
|
46 ## @end deftypefn |
|
47 |
|
48 function [x, P, n, k, d] = unmkpp (pp) |
|
49 if (nargin == 0) |
6046
|
50 print_usage (); |
5824
|
51 endif |
|
52 if (! isstruct (pp)) |
|
53 error ("unmkpp: expecting piecewise polynomial structure"); |
|
54 endif |
|
55 x = pp.x; |
|
56 P = pp.P; |
|
57 n = pp.n; |
|
58 k = pp.k; |
|
59 d = pp.d; |
|
60 endfunction |