Mercurial > octave-nkf
comparison scripts/control/system/abcddim.m @ 7136:59dcf01bb3e3
[project @ 2007-11-08 20:18:25 by jwe]
author | jwe |
---|---|
date | Thu, 08 Nov 2007 20:18:26 +0000 |
parents | a1dbe9d80eee |
children |
comparison
equal
deleted
inserted
replaced
7135:8aa770b6c5bf | 7136:59dcf01bb3e3 |
---|---|
66 ## a s hodel: modified to accept pure-gain systems aug 1996 | 66 ## a s hodel: modified to accept pure-gain systems aug 1996 |
67 | 67 |
68 function [n, m, p] = abcddim (a, b, c, d) | 68 function [n, m, p] = abcddim (a, b, c, d) |
69 | 69 |
70 if (nargin != 4) | 70 if (nargin != 4) |
71 error ("abcddim: four arguments required"); | 71 print_usage (); |
72 endif | 72 endif |
73 | 73 |
74 n = m = p = -1; | 74 n = m = p = -1; |
75 | 75 |
76 [a, an, am] = __abcddims__ (a); | 76 [a, an, am] = __abcddims__ (a); |
77 [b, bn, bm] = __abcddims__ (b); | 77 [b, bn, bm] = __abcddims__ (b); |
78 [c, cn, cm] = __abcddims__ (c); | 78 [c, cn, cm] = __abcddims__ (c); |
79 [d, dn, dm] = __abcddims__ (d); | 79 [d, dn, dm] = __abcddims__ (d); |
80 | 80 |
81 if ( (!issquare(a)) & (!isempty(a)) ) | 81 if (! issquare (a) && ! isempty (a)) |
82 warning (["abcddim: a is not square (",num2str(an),"x",num2str(am),")"]); | 82 warning ("abcddim: a is not square (%dx%d)", an, am); |
83 return | 83 return; |
84 endif | 84 endif |
85 | 85 |
86 if( (bm == 0) & (dm == 0) ) | 86 if (bm == 0 && dm == 0) |
87 warning("abcddim: no inputs"); | 87 warning ("abcddim: no inputs"); |
88 elseif (bn != am) | 88 elseif (bn != am) |
89 warning (["abcddim: a(",num2str(an),"x",num2str(am), ... | 89 warning ("abcddim: a(%dx%d) and b(%dx%d) are not compatible", |
90 " and b(",num2str(bn),"x",num2str(bm),") are not compatible"]); | 90 an, am, bn, bm); |
91 return | 91 return; |
92 endif | 92 endif |
93 | 93 |
94 if( (cn == 0) & (dn == 0 ) ) | 94 if (cn == 0 && dn == 0) |
95 warning("abcddim: no outputs"); | 95 warning ("abcddim: no outputs"); |
96 elseif (cm != an) | 96 elseif (cm != an) |
97 warning (["abcddim: a(",num2str(an),"x",num2str(am), ... | 97 warning ("abcddim: a(%dx%d) and c(%dx%d) are not compatible", |
98 " and c(",num2str(cn),"x",num2str(cm),") are not compatible"]); | 98 an, am, cn, cm); |
99 return | 99 return; |
100 endif | 100 endif |
101 | 101 |
102 have_connections = (bn*cn != 0); | 102 have_connections = (bn*cn != 0); |
103 | 103 |
104 if( (dn == 0) & have_connections) | 104 if (dn == 0 && have_connections) |
105 warning("abcddim: empty d matrix passed; setting compatibly with b, c"); | 105 warning ("abcddim: empty d matrix passed; setting compatibly with b, c"); |
106 [d, dn, dm] = __abcddims__ (zeros (cn, bm)); | 106 [d, dn, dm] = __abcddims__ (zeros (cn, bm)); |
107 endif | 107 endif |
108 | 108 |
109 if(an > 0) | 109 if (an > 0) |
110 [dn, dm] = size(d); | 110 [dn, dm] = size (d); |
111 if ( (cn != dn) & have_connections ) | 111 if (cn != dn && have_connections) |
112 warning (["abcddim: c(",num2str(cn),"x",num2str(cm), ... | 112 warning ("abcddim: c(%dx%d) and d(%dx%d) are not compatible", |
113 " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]); | 113 cn, cm, dn, dm); |
114 return | 114 return; |
115 endif | 115 endif |
116 | 116 |
117 if ( (bm != dm) & have_connections ) | 117 if (bm != dm && have_connections) |
118 warning (["abcddim: b(",num2str(bn),"x",num2str(bm), ... | 118 warning ("abcddim: b(",num2str(bn),"x",num2str(bm), ... |
119 " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]); | 119 " and d(",num2str(dn),"x",num2str(dm),") are not compatible"); |
120 return | 120 return; |
121 endif | 121 endif |
122 | 122 |
123 m = bm; | 123 m = bm; |
124 p = cn; | 124 p = cn; |
125 else | 125 else |
126 [p,m] = size(d); | 126 [p, m] = size (d); |
127 endif | 127 endif |
128 n = an; | 128 n = an; |
129 | |
129 endfunction | 130 endfunction |