1 ## Copyright (C) 2009, 2010 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 ## Block diagonal concatenation of two SS models.
20 ## This file is part of the Model Abstraction Layer.
21 ## For internal use only.
23 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
24 ## Created: September 2009
27 function retsys = __sys_group__ (sys1, sys2)
29 if (! isa (sys1, "ss"))
33 if (! isa (sys2, "ss"))
38 retsys.lti = __lti_group__ (sys1.lti, sys2.lti);
43 [p1, m1] = size (sys1.d);
44 [p2, m2] = size (sys2.d);
46 retsys.a = [sys1.a, zeros(n1,n2); zeros(n2,n1), sys2.a];
47 retsys.b = [sys1.b, zeros(n1,m2); zeros(n2,m1), sys2.b];
48 retsys.c = [sys1.c, zeros(p1,n2); zeros(p2,n1), sys2.c];
49 retsys.d = [sys1.d, zeros(p1,m2); zeros(p2,m1), sys2.d];
51 e1 = ! isempty (sys1.e);
52 e2 = ! isempty (sys2.e);
56 retsys.e = [sys1.e, zeros(n1,n2); zeros(n2,n1), sys2.e];
58 retsys.e = [sys1.e, zeros(n1,n2); zeros(n2,n1), eye(n2)];
60 retsys.e = [eye(n1), zeros(n1,n2); zeros(n2,n1), sys2.e];
64 retsys.stname = [sys1.stname; sys2.stname];