home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------
- //
- // obsv
- //
- // Syntax: ob=obsv(a,c)
- //
- // This routines forms the observability matrix.
- // ob=obsv(a,c,) returns the observability matrix.
- // ob = [c; ca; ca^2; ...]
- //
- // Copyright (C), by Jeffrey B. Layton, 1994
- // Version JBL 940919
- //--------------------------------------------------------------
-
- obsv = function(a,c)
- {
- local(nargs,D,i,ob)
-
- // Count number of inpute arguments
- nargs=0;
- if (exist(a)) {nargs=nargs+1;}
- if (exist(c)) {nargs=nargs+1;}
-
- if (nargs != 2) {
- error("OBSV: Wrong number of input arguments.");
- }
-
- ob=c;
- D=ones(a.nr,a.nc);
- for (i in 1:a.nc-1) {
- D=D*a;
- ob=[ob;c*D];
- }
-
- return ob
- };
-