7017
|
1 ## Copyright (C) 1996, 2000, 2002, 2004, 2005, 2006, 2007 |
|
2 ## Auburn University. All rights reserved. |
3430
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
7016
|
7 ## under the terms of the GNU General Public License as published by |
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
3430
|
10 ## |
7016
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
3430
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
3430
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ##@deftypefn {Function File} {[@var{zer}, @var{pol}, @var{k}, @var{tsam}, @var{inname}, @var{outname}] =} sys2zp (@var{sys}) |
|
22 ## Extract zero/pole/leading coefficient information from a system data |
5016
|
23 ## structure. |
3430
|
24 ## |
5016
|
25 ## See @command{zp} for parameter descriptions. |
3430
|
26 ## |
|
27 ## @strong{Example} |
|
28 ## @example |
4771
|
29 ## octave:1> sys=ss([1 -2; -1.1,-2.1],[0;1],[1 1]); |
3430
|
30 ## octave:2> [zer,pol,k] = sys2zp(sys) |
|
31 ## zer = 3.0000 |
|
32 ## pol = |
|
33 ## -2.6953 |
|
34 ## 1.5953 |
|
35 ## k = 1 |
|
36 ## @end example |
|
37 ## @end deftypefn |
|
38 |
|
39 ## Author: John Ingram <ingraje@eng.auburn.edu> |
|
40 ## Created: July 15, 1996 |
|
41 |
|
42 function [zer, pol, k, tsam, inname, outname] = sys2zp (sys) |
|
43 |
7136
|
44 if (nargin != 1) |
6046
|
45 print_usage (); |
7136
|
46 elseif (! isstruct (sys)) |
|
47 error ("sysconnect: sys must be in system data structure form") |
|
48 elseif (! is_siso (sys)) |
|
49 [n, nz, m, p] = sysdimensions (sys); |
|
50 error ("system is not SISO: %d inputs, %d outputs", m, p); |
3430
|
51 endif |
|
52 |
|
53 ## update zero-pole form |
7136
|
54 sys = sysupdate (sys, "zp"); |
3430
|
55 |
|
56 zer = sys.zer; |
|
57 pol = sys.pol; |
|
58 k = sys.k; |
7136
|
59 tsam = sysgettsam (sys); |
|
60 inname = sysgetsignals (sys, "in"); |
|
61 outname = sysgetsignals (sys, "out"); |
3430
|
62 |
|
63 endfunction |
|
64 |
|
65 |