Mercurial > hg > octave-nkf
diff scripts/control/sysupdate.m @ 3381:69b167451491
[project @ 1999-12-15 20:48:10 by jwe]
author | jwe |
---|---|
date | Wed, 15 Dec 1999 20:48:45 +0000 |
parents | 8dd4718801fd |
children | 10f21f7ccc7f |
line wrap: on
line diff
--- a/scripts/control/sysupdate.m +++ b/scripts/control/sysupdate.m @@ -1,20 +1,20 @@ -# Copyright (C) 1996 Auburn University. All Rights Reserved -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place, Suite 330, Boston, MA 0211 +## Copyright (C) 1996 Auburn University. All Rights Reserved +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. +## +## Octave is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 0211 ## -*- texinfo -*- ## @deftypefn {Function File } { @var{sys} =} sysupdate ( @var{sys}, @var{opt} ) @@ -49,9 +49,10 @@ ## See also: tf2sys, ss2sys, zp2sys, sysout, sys2ss, sys2tf, sys2zp function sys = sysupdate(sys,opt) -# Written by John Ingram 7-9-96 - # check for correct number of inputs + ## Written by John Ingram 7-9-96 + + ## check for correct number of inputs if (nargin != 2) usage("newsys = sysupdate(sys,opt)"); elseif(! is_struct(sys) ) @@ -61,22 +62,22 @@ error("2nd argument must be \"tf\", \"zp\", \"ss\", or \"all\""); endif - # check to make sure not trying to make a SISO system out of a MIMO sys + ## check to make sure not trying to make a SISO system out of a MIMO sys if ( (strcmp(opt,"tf") + strcmp(opt,"zp") + strcmp(opt,"all")) ... & strcmp(sysgettype(sys),"ss") & (! is_siso(sys) ) ) error("MIMO -> SISO update requested"); endif - # update transfer function if desired + ## update transfer function if desired if ( (strcmp(opt, "tf") + strcmp(opt,"all"))&& (!sys.sys(2))) - # check to make sure the system is not discrete and continuous + ## check to make sure the system is not discrete and continuous is_digital(sys); - # if original system zero-pole + ## if original system zero-pole if strcmp(sysgettype(sys),"zp") [sys.num,sys.den] = zp2tf(sys.zer,sys.pol,sys.k); sys.sys(2) = 1; - # if original system is state-space + ## if original system is state-space elseif(sys.sys(1) == 2) [sys.num,sys.den] = ss2tf(sys.a,sys.b,sys.c,sys.d); sys.sys(2) = 1; @@ -84,16 +85,16 @@ endif - # update zero-pole if desired + ## update zero-pole if desired if ( (strcmp(opt, "zp") + strcmp(opt,"all")) && (! sys.sys(3)) ) - # check to make sure the system is not discrete and continuous + ## check to make sure the system is not discrete and continuous is_digital(sys); - # original system is transfer function + ## original system is transfer function if (sys.sys(1) == 0) [sys.zer,sys.pol,sys.k] = tf2zp(sys.num,sys.den); sys.sys(3) = 1; - # original system is state-space + ## original system is state-space elseif(sys.sys(1) == 2) [sys.zer,sys.pol,sys.k] = ss2zp(sys.a,sys.b,sys.c,sys.d); @@ -102,19 +103,19 @@ endif - # update state-space if desired + ## update state-space if desired if ( (strcmp(opt, "ss") + strcmp(opt,"all")) && (! sys.sys(4)) ) - # original system is transfer function + ## original system is transfer function if (sys.sys(1) == 0) [sys.a,sys.b,sys.c,sys.d] = tf2ss(sys.num,sys.den); sys.sys(4) = 1; - # original system is zero-pole + ## original system is zero-pole elseif(sys.sys(1) == 1) [sys.a,sys.b,sys.c,sys.d] = zp2ss(sys.zer,sys.pol,sys.k); sys.sys(4) = 1; endif - # create new state names + ## create new state names sys.stname = sysdefstname(sys.n, sys.nz); endif