Mercurial > hg > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
11468:e1edf0ba3bcb | 11469:c776f063fefe |
---|---|
15 ## You should have received a copy of the GNU General Public License | 15 ## You should have received a copy of the GNU General Public License |
16 ## along with Octave; see the file COPYING. If not, see | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | 17 ## <http://www.gnu.org/licenses/>. |
18 | 18 |
19 ## -*- texinfo -*- | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {} polyint (@var{c}, @var{k}) | 20 ## @deftypefn {Function File} {} polyint (@var{p}) |
21 ## @deftypefnx {Function File} {} polyint (@var{p}, @var{k}) | |
21 ## Return the coefficients of the integral of the polynomial whose | 22 ## Return the coefficients of the integral of the polynomial whose |
22 ## coefficients are represented by the vector @var{c}. The variable | 23 ## coefficients are represented by the vector @var{p}. The variable |
23 ## @var{k} is the constant of integration, which by default is set to zero. | 24 ## @var{k} is the constant of integration, which by default is set to zero. |
24 ## @seealso{poly, polyderiv, polyreduce, roots, conv, deconv, residue, | 25 ## @seealso{poly, polyderiv, polyreduce, roots, conv, deconv, residue, |
25 ## filter, polyval, polyvalm} | 26 ## filter, polyval, polyvalm} |
26 ## @end deftypefn | 27 ## @end deftypefn |
27 | 28 |
28 ## Author: Tony Richardson <arichard@stark.cc.oh.us> | 29 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
29 ## Created: June 1994 | 30 ## Created: June 1994 |
30 ## Adapted-By: jwe | 31 ## Adapted-By: jwe |
31 | 32 |
32 function p = polyint (p, k) | 33 function retval = polyint (p, k) |
33 | 34 |
34 if (nargin < 1 || nargin > 2) | 35 if (nargin < 1 || nargin > 2) |
35 print_usage (); | 36 print_usage (); |
36 endif | 37 endif |
37 | 38 |
46 endif | 47 endif |
47 | 48 |
48 lp = length (p); | 49 lp = length (p); |
49 | 50 |
50 if (lp == 0) | 51 if (lp == 0) |
51 p = []; | 52 retval = []; |
52 return; | 53 return; |
53 endif | 54 endif |
54 | 55 |
55 if (rows (p) > 1) | 56 if (rows (p) > 1) |
56 ## Convert to column vector | 57 ## Convert to column vector |
57 p = p.'; | 58 p = p.'; |
58 endif | 59 endif |
59 | 60 |
60 p = [(p ./ [lp:-1:1]), k]; | 61 retval = [(p ./ [lp:-1:1]), k]; |
61 | 62 |
62 endfunction | 63 endfunction |