changeset 3759:110bc441a954

[project @ 2000-12-16 01:25:12 by jwe]
author jwe
date Sat, 16 Dec 2000 01:25:13 +0000
parents a816be1d1626
children 735549d1148e
files PROJECTS scripts/ChangeLog scripts/control/system/c2d.m scripts/strings/findstr.m scripts/strings/index.m
diffstat 5 files changed, 51 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/PROJECTS	Fri Dec 15 19:47:29 2000 +0000
+++ b/PROJECTS	Sat Dec 16 01:25:13 2000 +0000
@@ -440,9 +440,6 @@
   * Handle end-of-line comments correctly in parse trees for use with
     the type command.
 
-  * For dynamically linked functions, the which and type commands
-    should display the location of the .oct file.
-
   * Clean up eye, eval, feval, keyboard, input, ones, zeros.
 
   * It would be nice to have an interactive debugger.
--- a/scripts/ChangeLog	Fri Dec 15 19:47:29 2000 +0000
+++ b/scripts/ChangeLog	Sat Dec 16 01:25:13 2000 +0000
@@ -1,3 +1,16 @@
+2000-12-15  Teemu Ikonen  <tpikonen@pcu.helsinki.fi>
+
+	* strings/index.m: Return 0 if either string is empty.
+
+2000-12-15  Ben Sapp  <bsapp@lanl.gov>
+
+	* control/system/c2d.m: Allow option of matched pole/zero
+	equivalent for conversion.  
+
+2000-12-15  Matthew W. Roberts  <matt@lehi.tamu.edu>
+
+	* strings/findstr.m: Return empty matrix if search string is empty.
+
 2000-12-15  Kai Habel  <kai.habel@gmx.de>
 
 	* saveimage.m: Do create rawbit image for black and white images,
--- a/scripts/control/system/c2d.m	Fri Dec 15 19:47:29 2000 +0000
+++ b/scripts/control/system/c2d.m	Sat Dec 16 01:25:13 2000 +0000
@@ -46,6 +46,9 @@
 ##
 ## @strong{Note} If the 2nd argument is not a string, @code{c2d} assumes that
 ## the 2nd argument is @var{t} and performs appropriate argument checks.
+## @item "matched"
+## Use the matched pole/zero equivalent transformation (currently only
+## works for purely continuous SISO systems).
 ## @end table
 ##
 ## @strong{Outputs}
@@ -84,6 +87,10 @@
     opt = "ex";
   endif
 
+  if (! isstr (opt))
+    error ("expecting option as a string");
+  endif
+
   ## check if sampling period T was passed.
   Ts = sysgettsam(sys);
   if(!exist("T"))
@@ -99,8 +106,10 @@
 
   if (!is_sample(T))
     error("sampling period T must be a postive, real scalar");
-  elseif( ! (strcmp(opt,"ex") | strcmp(opt,"bi") ) )
-    error(["invalid option passed: ",opt])
+  elseif (! (strcmp (opt, "ex")
+	     || strcmp (opt, "bi")
+	     || strcmp (opt, "matched")))
+    error ("invalid option passed: %s", opt);
   endif
 
   sys = sysupdate(sys,"ss");
@@ -167,9 +176,26 @@
       D = d + (c*iab);
       stnamed = strappend(stname,"_d");
       dsys = ss2sys(A,B,C,D,T,0,rows(A),stnamed,inname,outname);
+   elseif(strcmp(opt,"matched"))
+     if(is_digital(sys))
+       error("c2d: system is already digital");
+     elseif((length(sys.inname) != 1) || (length(sys.outname) != 1))
+       error("c2d: system in not single input, single output");
+     else
+       sys = sysupdate(sys,"zp");
+       p = exp(sys.pol*T);
+       z = exp(sys.zer*T);
+       infinite_zeros = max(size(sys.pol))-max(size(sys.zer))-1;
+       for i = 1:infinite_zeros
+	 z = [z ; -1];
+       endfor
+       ## Should the freaquency we adjust around always be 1?   
+       [cmag,cphase,cw] = bode(sys,1);
+       [dmag,dpahse,dw] = bode(zp2sys(z,p,1,T),1);
+      dsys = zp2sys(z,p,cmag/dmag,T);
     endif
   else
-    error(["Bad option=",opt])
+    error ("invalid option = %s", opt);
   endif
 
 endfunction
--- a/scripts/strings/findstr.m	Fri Dec 15 19:47:29 2000 +0000
+++ b/scripts/strings/findstr.m	Sat Dec 16 01:25:13 2000 +0000
@@ -60,6 +60,11 @@
 
     l_t = length (t);
 
+    if (l_t < 1)
+      v = [];
+      return;
+    endif
+
     ind = 1 : l_t;
     limit = length (s) - l_t + 1;
     v  = zeros (1, limit);
--- a/scripts/strings/index.m	Fri Dec 15 19:47:29 2000 +0000
+++ b/scripts/strings/index.m	Sat Dec 16 01:25:13 2000 +0000
@@ -48,6 +48,10 @@
     [nr_s, l_s] = size (s);
     [nr_t, l_t] = size (t);
 
+    if (nr_s == 0 || nr_t == 0)
+      return;
+    endif
+
     if (nr_s != 1 || nr_t != 1)
       error ("index: arguments cannot be string arrays");
     endif