3381
|
1 ## Copyright (C) 1996 Auburn University. All Rights Reserved. |
|
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 the |
|
7 ## Free Software Foundation; either version 2, or (at your option) any |
|
8 ## later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 ## for more details. |
|
14 ## |
|
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 |
|
17 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. |
3346
|
18 |
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Function File } { outputs =} ss2zp ( inputs ) |
|
21 ## @format |
|
22 ## Converts a state space representation to a set of poles and zeros. |
|
23 ## |
|
24 ## [pol,zer,k] = ss2zp(a,b,c,d) returns the poles and zeros of the state space |
|
25 ## system (a,b,c,d). K is a gain associated with the zeros. |
|
26 ## |
|
27 ## used internally in system data structure format manipulations |
|
28 ## |
|
29 ## |
|
30 ## @end format |
|
31 ## @end deftypefn |
|
32 |
3213
|
33 |
|
34 function [zer,pol,k] = ss2zp(a,b,c,d) |
3381
|
35 |
|
36 ## Written by David Clem August 15, 1994 |
|
37 ## Hodel: changed order of output arguments to zer, pol, k. July 1996 |
|
38 ## a s hodel: added argument checking, allow for pure gain blocks aug 1996 |
3213
|
39 |
|
40 if(nargin != 4) |
|
41 usage("[zer,pol,k] = ss2zp(a,b,c,d)"); |
|
42 endif |
|
43 |
|
44 [n,m,p] = abcddim(a,b,c,d); |
|
45 if (n == -1) |
|
46 error("ss2tf: Non compatible matrix arguments"); |
|
47 elseif ( (m != 1) | (p != 1)) |
|
48 error(["ss2tf: not SISO system: m=",num2str(m)," p=",num2str(p)]); |
|
49 endif |
|
50 |
|
51 if(n == 0) |
3381
|
52 ## gain block only |
3213
|
53 k = d; |
|
54 zer = pol = []; |
|
55 else |
3381
|
56 ## First, get the denominator coefficients |
3213
|
57 [zer,k] = tzero(a,b,c,d); |
|
58 pol = eig(a); |
|
59 endif |
|
60 endfunction |
|
61 |