1 ## Copyright (C) 2003 Willem J. Atsma <watsma@users.sf.net>
3 ## This program is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU General Public
5 ## License as published by the Free Software Foundation;
6 ## either version 2, or (at your option) any later version.
8 ## This software is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied
10 ## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 ## PURPOSE. See the GNU General Public License for more
14 ## You should have received a copy of the GNU General Public
15 ## License along with this software; see the file COPYING. If not,
16 ## see <http://www.gnu.org/licenses/>.
19 ## @deftypefn {Function File} {@var{p} =} poly2sym (@var{c}, @var{x})
20 ## Creates a symbolic polynomial expression @var{p} with coefficients @var{c}.
21 ## If @var{p} is not specified, the free variable is set to sym("x"). @var{c}
22 ## may be a vector or a cell-array of symbols. @var{x} may be a symbolic
23 ## expression or a string.
24 ## The coefficients correspond to decreasing exponent of the free variable.
31 ## p = poly2sym ([2,5,-3]); # p = 2*x^2+5*x-3
32 ## c = poly2sym (@{2*y,5,-3@},x); # p = 2*y*x^2+5*x-3
35 ## @seealso{sym2poly,polyval,roots}
38 function p = poly2sym(c,x)