1 ## Copyright (C) 2009, 2011 Lukas F. Reichlin
3 ## This file is part of LTI Syncope.
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>.
19 ## @deftypefn {Function File} {@var{z} =} zero (@var{sys})
20 ## @deftypefnx {Function File} {[@var{z}, @var{k}] =} zero (@var{sys})
21 ## Compute transmission zeros and gain of LTI model.
32 ## Transmission zeros of @var{sys}.
38 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
39 ## Created: October 2009
42 function [zer, gain] = zero (sys)
48 [zer, gain] = __zero__ (sys, nargout);
53 ## transmission zeros of state-space models
55 ## Results from the "Dark Side" 7.5 and 7.8
61 ## Results from Scilab 5.2.0b1 (trzeros)
68 %! A = [ -0.7 -0.0458 -12.2 0
69 %! 0 -0.014 -0.2904 -0.562
84 %! sys = ss (A, B, C, D, "scaled", true);
85 %! z = sort (zero (sys));
87 %! z_exp = sort ([-13.2759; 12.5774; -0.0155]);
89 %!assert (z, z_exp, 1e-4);
92 ## transmission zeros of descriptor state-space models
94 %! A = [ 1 0 0 0 0 0 0 0 0
102 %! 0 0 0 0 0 0 0 0 1 ];
104 %! E = [ 0 0 0 0 0 0 0 0 0
112 %! 0 0 0 0 0 0 0 1 0 ];
124 %! C = [ 0 1 1 0 3 4 0 0 2
126 %! 0 0 1 0 -1 4 0 -2 2 ];
132 %! sys = dss (A, B, C, D, E, "scaled", true);
137 %!assert (z, z_exp, 1e-4);
140 ## Gain of descriptor state-space models
141 %!shared p, pi, z, zi, k, ki, p_tf, pi_tf, z_tf, zi_tf, k_tf, ki_tf
142 %! P = ss (-2, 3, 4, 5);
146 %! [z, k] = zero (P);
149 %! [zi, ki] = zero (Pi);
154 %! p_tf = pole (P_tf);
155 %! [z_tf, k_tf] = zero (P_tf);
157 %! pi_tf = pole (Pi_tf);
158 %! [zi_tf, ki_tf] = zero (Pi_tf);
160 %!assert (p, zi, 1e-4);
161 %!assert (z, pi, 1e-4);
162 %!assert (k, inv (ki), 1e-4);
163 %!assert (p_tf, zi_tf, 1e-4);
164 %!assert (z_tf, pi_tf, 1e-4);
165 %!assert (k_tf, inv (ki_tf), 1e-4);