Mercurial > hg > octave-lyh
annotate scripts/polynomial/polyint.m @ 11469:c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 09 Jan 2011 12:41:21 -0800 |
parents | d1978e7364ad |
children | fd0a3ac60b0e |
rev | line source |
---|---|
9245 | 1 ## Copyright (C) 1996, 1997, 2007, 2008, 2009 John W. Eaton |
6853 | 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. | |
6853 | 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/>. | |
6853 | 18 |
19 ## -*- texinfo -*- | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10635
diff
changeset
|
20 ## @deftypefn {Function File} {} polyint (@var{p}) |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10635
diff
changeset
|
21 ## @deftypefnx {Function File} {} polyint (@var{p}, @var{k}) |
6853 | 22 ## Return the coefficients of the integral of the polynomial whose |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10635
diff
changeset
|
23 ## coefficients are represented by the vector @var{p}. The variable |
6853 | 24 ## @var{k} is the constant of integration, which by default is set to zero. |
25 ## @seealso{poly, polyderiv, polyreduce, roots, conv, deconv, residue, | |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7151
diff
changeset
|
26 ## filter, polyval, polyvalm} |
6853 | 27 ## @end deftypefn |
28 | |
29 ## Author: Tony Richardson <arichard@stark.cc.oh.us> | |
30 ## Created: June 1994 | |
31 ## Adapted-By: jwe | |
32 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10635
diff
changeset
|
33 function retval = polyint (p, k) |
6853 | 34 |
35 if (nargin < 1 || nargin > 2) | |
36 print_usage (); | |
37 endif | |
38 | |
39 if (nargin == 1) | |
40 k = 0; | |
41 elseif (! isscalar (k)) | |
42 error ("polyint: the constant of integration must be a scalar"); | |
43 endif | |
44 | |
45 if (! (isvector (p) || isempty (p))) | |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
46 error ("polyint: argument must be a vector"); |
6853 | 47 endif |
48 | |
49 lp = length (p); | |
50 | |
51 if (lp == 0) | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10635
diff
changeset
|
52 retval = []; |
6853 | 53 return; |
7151 | 54 endif |
6853 | 55 |
56 if (rows (p) > 1) | |
57 ## Convert to column vector | |
58 p = p.'; | |
59 endif | |
60 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10635
diff
changeset
|
61 retval = [(p ./ [lp:-1:1]), k]; |
6853 | 62 |
63 endfunction |