Mercurial > octave-nkf
comparison scripts/control/system/is_digital.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 |
---|---|
45 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> | 45 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
46 ## Created: July 1996 | 46 ## Created: July 1996 |
47 | 47 |
48 function DIGITAL = is_digital (sys, eflg) | 48 function DIGITAL = is_digital (sys, eflg) |
49 | 49 |
50 switch(nargin) | 50 switch (nargin) |
51 case(1), eflg = 0; | 51 case 1 |
52 case(2), | 52 eflg = 0; |
53 if( isempty(find(eflg == [0, 1, 2])) ) | 53 case 2 |
54 error("invalid value of eflg=%d (%e)",eflg,eflg); | 54 if (isempty (find (eflg == [0, 1, 2]))) |
55 error ("invalid value of eflg=%g", eflg); | |
55 endif | 56 endif |
56 otherwise, | 57 otherwise, |
57 print_usage (); | 58 print_usage (); |
58 endswitch | 59 endswitch |
59 | 60 |
60 ## checked for sampled data system (mixed) | 61 ## checked for sampled data system (mixed) |
61 ## discrete system | 62 ## discrete system |
62 sysyd = sysgetsignals(sys,"yd"); | 63 sysyd = sysgetsignals (sys, "yd"); |
63 [nn,nz] = sysdimensions(sys); | 64 [nn, nz] = sysdimensions (sys); |
64 cont = sum(sysyd == 0) + nn; | 65 cont = sum (sysyd == 0) + nn; |
65 tsam = sysgettsam(sys); | 66 tsam = sysgettsam (sys); |
66 dig = sum(sysyd != 0) + nz + tsam; | 67 dig = sum (sysyd != 0) + nz + tsam; |
67 | 68 |
68 ## check for mixed system | 69 ## check for mixed system |
69 if( cont*dig != 0) | 70 if (cont*dig != 0) |
70 switch(eflg) | 71 switch (eflg) |
71 case(0), | 72 case 0 |
72 error("continuous/discrete system; use syscont, sysdisc, or c2d first"); | 73 error ("continuous/discrete system; use syscont, sysdisc, or c2d first"); |
73 case(1), | 74 case 1 |
74 warning("is_digital: mixed continuous/discrete system"); | 75 warning ("is_digital: mixed continuous/discrete system"); |
75 endswitch | 76 endswitch |
76 dig_sign = -1; | 77 dig_sign = -1; |
77 else | 78 else |
78 dig_sign = 1; | 79 dig_sign = 1; |
79 endif | 80 endif |