Mercurial > hg > octave-nkf
diff scripts/control/system/sysadd.m @ 4404:c05051baf03b
[project @ 2003-05-01 19:41:57 by jwe]
author | jwe |
---|---|
date | Thu, 01 May 2003 19:42:10 +0000 |
parents | 22bd65326ec1 |
children | b8105302cfe8 |
line wrap: on
line diff
--- a/scripts/control/system/sysadd.m +++ b/scripts/control/system/sysadd.m @@ -73,19 +73,25 @@ endfor ## perform the add - if(nargin == 2) - Gsys = nth(arglist,1); Hsys = nth(arglist,2); - if( strcmp(sysgettype(Gsys),"tf") | strcmp(sysgettype(Hsys),"tf") ) - ## see if adding transfer functions with identical denominators + if (nargin == 2) + Gsys = nth(arglist,1); + Hsys = nth(arglist,2); + + if (! strcmp (sysgettype (Gsys), "tf")) [Gnum,Gden,GT,Gin,Gout] = sys2tf(Gsys); + endif + + if (! strcmp (sysgettype (Hsys),"tf")) [Hnum,Hden,HT,Hin,Hout] = sys2tf(Hsys); - if(length(Hden) == length(Gden) ) - if( (Hden == Gden) & (HT == GT) ) - sys = tf2sys(Gnum+Hnum,Gden,GT,Gin,Gout); - return - endif - ## if not, we go on and do the usual thing... + endif + + ## see if adding transfer functions with identical denominators + if (length(Hden) == length(Gden) ) + if( (Hden == Gden) & (HT == GT) ) + sys = tf2sys(Gnum+Hnum,Gden,GT,Gin,Gout); + return endif + ## if not, we go on and do the usual thing... endif ## make sure in ss form