comparison scripts/polynomial/compan.m @ 3368:a4cd1e9d9962

[project @ 1999-11-20 17:22:48 by jwe]
author jwe
date Sat, 20 Nov 1999 17:23:01 +0000
parents 44d82b369c78
children f8dde1807dee
comparison
equal deleted inserted replaced
3367:0748b03c3510 3368:a4cd1e9d9962
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, write to the Free 16 ## along with Octave; see the file COPYING. If not, write to the Free
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA. 18 ## 02111-1307, USA.
19 19
20 ## usage: compan (c) 20 ## -*- texinfo -*-
21 ## 21 ## @deftypefn {Function File} {} compan (@var{c})
22 ## Compute the companion matrix corresponding to polynomial vector c. 22 ## Compute the companion matrix corresponding to polynomial coefficient
23 ## 23 ## vector @var{c}.
24 ## In octave a polynomial is represented by it's coefficients (arranged 24 ##
25 ## in descending order). For example a vector c of length n+1 corresponds 25 ## The companion matrix is
26 ## to the following nth order polynomial 26 ## @iftex
27 ## 27 ## @tex
28 ## p(x) = c(1) x^n + ... + c(n) x + c(n+1). 28 ## $$
29 ## 29 ## A = \left[\matrix{
30 ## The corresponding companion matrix is 30 ## -c_2/c_1 & -c_3/c_1 & \cdots & -c_N/c_1 & -c_{N+1}/c_1\cr
31 ## _ _ 31 ## 1 & 0 & \cdots & 0 & 0 \cr
32 ## | -c(2)/c(1) -c(3)/c(1) ... -c(n)/c(1) -c(n+1)/c(1) | 32 ## 0 & 1 & \cdots & 0 & 0 \cr
33 ## | 1 0 ... 0 0 | 33 ## \vdots & \vdots & \ddots & \vdots & \vdots \cr
34 ## | 0 1 ... 0 0 | 34 ## 0 & 0 & \cdots & 1 & 0}\right].
35 ## A = | . . . . . | 35 ## $$
36 ## | . . . . . | 36 ## @end tex
37 ## | . . . . . | 37 ## @end iftex
38 ## |_ 0 0 ... 1 0 _| 38 ## @ifinfo
39 ## 39 ##
40 ## @smallexample
41 ## _ _
42 ## | -c(2)/c(1) -c(3)/c(1) ... -c(N)/c(1) -c(N+1)/c(1) |
43 ## | 1 0 ... 0 0 |
44 ## | 0 1 ... 0 0 |
45 ## A = | . . . . . |
46 ## | . . . . . |
47 ## | . . . . . |
48 ## |_ 0 0 ... 1 0 _|
49 ## @end smallexample
50 ## @end ifinfo
51 ##
40 ## The eigenvalues of the companion matrix are equal to the roots of the 52 ## The eigenvalues of the companion matrix are equal to the roots of the
41 ## polynomial. 53 ## polynomial.
42 ## 54 ## @end deftypefn
55
43 ## SEE ALSO: poly, roots, residue, conv, deconv, polyval, polyderiv, polyinteg 56 ## SEE ALSO: poly, roots, residue, conv, deconv, polyval, polyderiv, polyinteg
44 57
45 ## Author: Tony Richardson <arichard@stark.cc.oh.us> 58 ## Author: Tony Richardson <arichard@stark.cc.oh.us>
46 ## Created: June 1994 59 ## Created: June 1994
47 ## Adapted-By: jwe 60 ## Adapted-By: jwe