help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rlocus and zp2sys


From: A S Hodel
Subject: Re: rlocus and zp2sys
Date: Mon, 2 Feb 2004 11:06:07 -0600

On Wednesday, November 19, 2003, at 01:11 AM, Shaun Jackman wrote:

I've upgraded to rlocus, and am trying to use it with zp2sys now. I've
run into the following error.

G_z = [];
G_p = -2*pi * [1e3 10e3 10e3];
G_k = 1000;
G = zp2sys( G_z, G_p, G_k);
rlocus( G)

num = 1000
den =

   1.0000e+00   1.3195e+05   4.7374e+09   2.4805e+13

error: number of columns must match (2 != 1)
error: evaluating assignment expression near line 97, column 7
error: evaluating if command near line 71, column 3
error: called from `sysgroup' in file
`/usr/share/octave/2.1.50/m/control/system/sysgroup.m'

I'm sorry for the long delay in responding. I've traced this problem to sysgroup.
The above code works on my machine now
(octave 2.1.50 on Mac OS X 10.2.8). The problem is that the behavior of grouping empty matrices, e.g., zeros(0,1) changed since I originally wrote this function.
The if blocks in the patch below take care of the problem.

Please apply the following patch.

A. S. Hodel Dept. ECE, 200 Broun Hall, Auburn University AL 36849-5201
(334) 844-1854/fax(334) 844-1809, http://www.eng.auburn.edu/users/hodelas , address@hidden

===================================================================
RCS file: RCS/sysgroup.m,v
retrieving revision 2.0
diff -c -r2.0 sysgroup.m
*** sysgroup.m  2004/02/02 15:44:58     2.0
--- sysgroup.m  2004/02/02 16:55:53
***************
*** 74,83 ****
      Bsys = nth(arglist,2);

      ## extract information from Asys, Bsys to consruct sys
-     Asys = sysupdate(Asys,"ss");
-     Bsys = sysupdate(Bsys,"ss");
      [n1,nz1,m1,p1] = sysdimensions(Asys);
      [n2,nz2,m2,p2] = sysdimensions(Bsys);
      [Aa,Ab,Ac,Ad,Atsam,An,Anz,Ast,Ain,Aout,Ayd] = sys2ss(Asys);
      [Ba,Bb,Bc,Bd,Btsam,Bn,Bnz,Bst,Bin,Bout,Byd] = sys2ss(Bsys);
      nA = An + Anz;
--- 74,85 ----
      Bsys = nth(arglist,2);

      ## extract information from Asys, Bsys to consruct sys
      [n1,nz1,m1,p1] = sysdimensions(Asys);
      [n2,nz2,m2,p2] = sysdimensions(Bsys);
+
+     Asys = sysupdate(Asys,"ss");
+     Bsys = sysupdate(Bsys,"ss");
+
      [Aa,Ab,Ac,Ad,Atsam,An,Anz,Ast,Ain,Aout,Ayd] = sys2ss(Asys);
      [Ba,Bb,Bc,Bd,Btsam,Bn,Bnz,Bst,Bin,Bout,Byd] = sys2ss(Bsys);
      nA = An + Anz;
***************
*** 93,102 ****
        error("sysgroup: Asys.tsam=%e, Bsys.tsam =%e", Atsam, Btsam);
      endif

!     A = [Aa,zeros(nA,nB); zeros(nB,nA),Ba];
!     B = [Ab,zeros(nA,m2); zeros(nB,m1),Bb];
!     C = [Ac,zeros(p1,nB); zeros(p2,nA),Bc];
!     D = [Ad,zeros(p1,m2); zeros(p2,m1),Bd];
      tsam = max(Atsam,Btsam);

## construct combined signal names; stnames must check for pure gain blocks
--- 95,142 ----
        error("sysgroup: Asys.tsam=%e, Bsys.tsam =%e", Atsam, Btsam);
      endif

!     if(nA*nB > 0)
!       A12 = zeros(nA,nB);
!     else
!       A12 = [];
!     endif
!     A = [Aa,A12; A12', Ba];
!
!     if(nA*m2 > 0)
!       B12 = zeros(nA,m2);
!     else
!       B12 = [];
!     endif
!     if(nB*m1 > 0)
!       B21 = zeros(nB,m1);
!     else
!       B21 = [];
!     endif
!     B = [Ab, B12; B21, Bb];
!
!     if(p1*nB > 0)
!       C12 = zeros(p1,nB);
!     else
!       C12 = [];
!     endif
!     if(p2*nA > 0)
!       C21 = zeros(p2,nA);
!     else
!       C21 = [];
!     endif
!     C = [Ac, C12; C21,Bc];
!
!     if(p1*m2 > 0)
!       D12 = zeros(p1,m2);
!     else
!       D12 = [];
!     endif
!     if(p2*m1 > 0)
!       D21 = zeros(p2,m1);
!     else
!       D21 = [];
!     endif
!     D = [Ad, D12; D21, Bd];
      tsam = max(Atsam,Btsam);

## construct combined signal names; stnames must check for pure gain blocks
***************
*** 139,145 ****
## multiple systems (or a single system); combine together one by one
      sys = nth(arglist,1);
      for kk=2:length(arglist)
-       printf("sysgroup: kk=%d\n",kk);
        sys = sysgroup(sys,nth(arglist,kk));
      endfor
    endif
--- 179,184 ----



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]