home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / r / rlab / CTB / ctrb < prev    next >
Encoding:
Text File  |  1995-11-15  |  547 b   |  29 lines

  1. //-----------------------------------------------------------
  2. //
  3. // ctrb
  4. //
  5. // Syntax: co=ctrb(a,b)
  6. //
  7. // This routine forms the controllability matrix.
  8. // co = ctrb(a,b) returns the controllability matrix
  9. // co = [B AB A^2B ...]
  10. //
  11. // Copyright (C), by Jeffrey B. Layton, 1994
  12. // Version JBL 940920
  13. //-----------------------------------------------------------
  14.  
  15. ctrb = function(a,b)
  16. {
  17.    local(D,i,co)
  18.  
  19. // Start by setting co to b
  20.    co = b;
  21.    D=eye(a.nr,a.nc);
  22.    for (i in 1:a.nc-1) {
  23.         D=D*a;
  24.         co=[co,D*b];
  25.    }
  26.  
  27.    return co
  28. };
  29.