home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------------
- //
- // augstate
- //
- // Syntax: G=augstate(a,b,c,d)
- //
- // This routine augments the outputs of a state-space system with the
- // states of the system. Calling the routine as G=augstate(A,B,C,D)
- // produces the following augmented system:
- // .
- // x = Ax + Bu
- //
- // |y| = |C| x + |D| u
- // |x| |I| |0|
- //
- // The results are returned in a list:
- //
- // G.aa = augmented A matrix (no change from input)
- // G.ba = augmented B matrix (no change from input)
- // G.ca = augmented C matrix
- // G.da = augmented D matrix
- //
- // Copyright (C), by Jeffrey B. Layton
- // Version JBL 940922
- //-------------------------------------------------------------------------
-
- rfile abcdchk
-
- augstate = function(a,b,c,d)
- {
- local(nargs,msg,estr,aa,ba,ca,da)
-
- // Count number of arguments
- nargs=0;
- if (exist(a)) {nargs=nargs+1;}
- if (exist(b)) {nargs=nargs+1;}
- if (exist(c)) {nargs=nargs+1;}
- if (exist(d)) {nargs=nargs+1;}
-
- if (nargs != 4) {
- error("AUGSTATE: Wrong number of input arguments.");
- }
-
- // Check input system
- msg="";
- msg=abcdchk(a,b,c,d);
- if (msg != "") {
- estr="AUGSTATE: "+msg;
- error(estr);
- }
-
- // Augment
- aa=a;
- ba=b;
- ca=[c;eye(a.nr,a.nc)];
- da=[d;zeros(a.nr,d.nc)];
-
- return << aa=aa; ba=ba; ca=ca; da=da >>
- };
-