3430
|
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 |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301 USA. |
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 |
|
44 if(nargin != 1) |
6046
|
45 print_usage (); |
4030
|
46 elseif( !isstruct(sys)) |
3430
|
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 (",num2str(m)," inputs, ... |
|
51 ", num2str(p)," outputs"]); |
|
52 endif |
|
53 |
|
54 ## update zero-pole form |
|
55 sys = sysupdate(sys,"zp"); |
|
56 |
|
57 zer = sys.zer; |
|
58 pol = sys.pol; |
|
59 k = sys.k; |
|
60 tsam = sysgettsam(sys); |
|
61 inname = sysgetsignals(sys,"in"); |
|
62 outname = sysgetsignals(sys,"out"); |
|
63 |
|
64 endfunction |
|
65 |
|
66 |