From bug-octave-request at bevo dot che dot wisc dot edu Mon Nov 4 15:59:16 2002 Subject: Re: a bug in syssub.m (was sysmult.m) From: "John W. Eaton" To: A S Hodel Cc: "K.Yoshida" , bug-octave@bevo.che.wisc.edu Date: Mon, 4 Nov 2002 15:59:13 -0600 On 2-Nov-2002, A S Hodel wrote: | > | > I've found a bug in sysmult.m. When the denominators of transfer | > functions sys1 and sys2 are the same, the function "sysmult(sys1,sys2)" | > returns the sum of sys1 and sys2. | > In sysmult.m, in the 9th line below from the line "## perform the | > subtract" | > the line | > sys = tf2sys(Gnum+Hnum,Gden,GT,Gin,Gout); | > should be | > sys = tf2sys(Gnum-Hnum,Gden,GT,Gin,Gout); | | The problem is not in sysmult, but in syssub. The correction listed | above is correct for that subroutine. | Here's a patch: | | *** /sw/share/octave/2.1.35/m/control/system/syssub.m Thu Oct 31 | 18:59:31 2002--- ./syssub.m Sat Nov 2 15:27:34 2002 | *************** | *** 81,87 **** | [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... | --- 81,87 ---- | [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... I made this change. Thanks, jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------