comparison scripts/control/sysupdate.m @ 3228:dbcc24961c44

[project @ 1998-12-09 18:42:12 by jwe]
author jwe
date Wed, 09 Dec 1998 18:42:13 +0000
parents ba1c7cdc6090
children 28aba52a2368
comparison
equal deleted inserted replaced
3227:e090571062ee 3228:dbcc24961c44
32 # mixed continuous/digital 32 # mixed continuous/digital
33 # 33 #
34 # see also: tf2sys, ss2sys, zp2sys, sysout, sys2ss, sys2tf, sys2zp 34 # see also: tf2sys, ss2sys, zp2sys, sysout, sys2ss, sys2tf, sys2zp
35 35
36 # Written by John Ingram 7-9-96 36 # Written by John Ingram 7-9-96
37 # $Revision: 1.1.1.1 $ 37 # $Revision: 2.0.0.0 $
38 38
39 # check for correct number of inputs 39 # check for correct number of inputs
40 if (nargin != 2) 40 if (nargin != 2)
41 usage("newsys = sysupdate(sys,opt)"); 41 usage("newsys = sysupdate(sys,opt)");
42 elseif(! is_struct(sys) ) 42 elseif(! is_struct(sys) )
46 error("2nd argument must be \"tf\", \"zp\", \"ss\", or \"all\""); 46 error("2nd argument must be \"tf\", \"zp\", \"ss\", or \"all\"");
47 endif 47 endif
48 48
49 # check to make sure not trying to make a SISO system out of a MIMO sys 49 # check to make sure not trying to make a SISO system out of a MIMO sys
50 if ( (strcmp(opt,"tf") + strcmp(opt,"zp") + strcmp(opt,"all")) ... 50 if ( (strcmp(opt,"tf") + strcmp(opt,"zp") + strcmp(opt,"all")) ...
51 & (sys.sys(1) == 2) & (! is_siso(sys) ) ) 51 & strcmp(sysgettype(sys),"ss") & (! is_siso(sys) ) )
52 error("MIMO -> SISO update requested"); 52 error("MIMO -> SISO update requested");
53 endif 53 endif
54 54
55 # update transfer function if desired 55 # update transfer function if desired
56 if ( (strcmp(opt, "tf") + strcmp(opt,"all"))&& (!sys.sys(2))) 56 if ( (strcmp(opt, "tf") + strcmp(opt,"all"))&& (!sys.sys(2)))
57 # check to make sure the system is not discrete and continuous 57 # check to make sure the system is not discrete and continuous
58 is_digital(sys); 58 is_digital(sys);
59 59
60 # if original system zero-pole 60 # if original system zero-pole
61 if (sys.sys(1) == 1) 61 if strcmp(sysgettype(sys),"zp")
62 [sys.num,sys.den] = zp2tf(sys.zer,sys.pol,sys.k); 62 [sys.num,sys.den] = zp2tf(sys.zer,sys.pol,sys.k);
63 sys.sys(2) = 1; 63 sys.sys(2) = 1;
64 # if original system is state-space 64 # if original system is state-space
65 elseif(sys.sys(1) == 2) 65 elseif(sys.sys(1) == 2)
66 [sys.num,sys.den] = ss2tf(sys.a,sys.b,sys.c,sys.d); 66 [sys.num,sys.den] = ss2tf(sys.a,sys.b,sys.c,sys.d);