1 ## Copyright (C) 2009 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{sys} =} lft (@var{sys1}, @var{sys2})
20 ## @deftypefnx {Function File} {@var{sys} =} lft (@var{sys1}, @var{sys2}, @var{nu}, @var{ny})
21 ## Linear fractional tranformation, also known as Redheffer star product.
30 ## The last nu inputs of @var{sys1} are connected with the first nu outputs of @var{sys2}.
31 ## If not specified, @code{min (m1, p2)} is taken.
33 ## The last ny outputs of @var{sys1} are connected with the first ny inputs of @var{sys2}.
34 ## If not specified, @code{min (p1, m2)} is taken.
40 ## Resulting LTI model.
43 ## @strong{Block Diagram}
46 ## .............sys..............
48 ## w1 ------------>| |------------> z1
50 ## : u +---->| |-----+ y :
51 ## : | +--------+ | : Lower LFT
53 ## : | +--------+ | : lft (sys1, sys2)
54 ## : +-----| sys2 |<----+ :
56 ## :............................:
61 ## .............sys..............
63 ## : u +---->| sys1 |-----+ y :
64 ## : | +--------+ | : Upper LFT
66 ## : | +--------+ | : lft (sys1, sys2)
67 ## : +-----| |<----+ :
69 ## z2 <------------| |<------------ w2
71 ## :............................:
76 ## .............sys..............
78 ## w1 ------------>| |------------> z1
80 ## : u +---->| |-----+ y :
82 ## : | | : lft (sys1, sys2, nu, ny)
84 ## : +-----| |<----+ :
86 ## z2 <------------| |<------------ w2
88 ## :............................:
93 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
94 ## Created: October 2009
97 function sys = lft (sys1, sys2, nu, ny)
99 if (nargin != 2 && nargin != 4)
103 ## object conversion done by sys_group if necessary
105 [p1, m1] = size (sys1);
106 [p2, m2] = size (sys2);
108 nu_max = min (m1, p2);
109 ny_max = min (m2, p1);
111 if (nargin == 2) # sys = lft (sys1, sys2)
114 else # sys = lft (sys1, sys2, nu, ny)
115 if (! is_real_scalar (nu) || nu < 0)
116 error ("lft: argument nu must be a positive integer");
119 if (! is_real_scalar (ny) || ny < 0)
120 error ("lft: argument ny must be a positive integer");
124 error ("lft: argument nu (%d) must be at most %d", nu, nu_max);
128 error ("lft: argument ny (%d) must be at most %d", ny, ny_max);
132 M11 = zeros (m1, p1);
133 M12 = [zeros(m1-nu, p2); eye(nu), zeros(nu, p2-nu)];
134 M21 = [zeros(ny, p1-ny), eye(ny); zeros(m2-ny, p1)];
135 M22 = zeros (m2, p2);
137 M = [M11, M12; M21, M22];
139 in_idx = [1 : (m1-nu), m1 + (ny+1 : m2)];
140 out_idx = [1 : (p1-ny), p1 + (nu+1 : p2)];
142 sys = __sys_group__ (sys1, sys2);
143 sys = __sys_connect__ (sys, M);
144 sys = __sys_prune__ (sys, out_idx, in_idx);
149 warning ("lft: resulting system has no inputs");
153 warning ("lft: resulting system has no outputs");