<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>findAC</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1999</DATE>
  <SHORT_DESCRIPTION name="findAC"> discrete-time system subspace identification</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>[A,C] = findAC(S,N,L,R,METH,TOL,PRINTW)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>[A,C,RCND] = findAC(S,N,L,R,METH,TOL,PRINTW)   </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>S</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: integer, the number of block rows in the block-Hankel matrices</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>N</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: integer</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>L</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: integer</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>R</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: matrix, relevant part of the  R factor of the concatenated block-Hankel matrices computed by a call to findr.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>METH</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: integer, an option for the method to use</SP>
          <PARAM_INDENT>
            <PARAM_ITEM>
              <PARAM_NAME>= 1</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>:  MOESP method with past inputs and outputs;</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
            <PARAM_ITEM>
              <PARAM_NAME>= 2</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>:  N4SID method;</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
          </PARAM_INDENT>
          <P>
    Default:    METH = 3.
  </P>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>TOL</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: the tolerance used for estimating the rank of matrices.  If  TOL &gt; 0,  then the given value of  TOL  is used as a lower bound for the reciprocal condition number. Default: prod(size(matrix))*epsilon_machine where epsilon_machine is the relative machine precision.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>PRINTW</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: integer, switch for printing the warning messages.</SP>
          <PARAM_INDENT>
            <PARAM_ITEM>
              <PARAM_NAME>PRINTW</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>= 1: print warning messages;</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
            <PARAM_ITEM>
              <PARAM_NAME>= 0</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>: do not print warning messages.</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
          </PARAM_INDENT>
          <P>
    Default:    PRINTW = 0.
  </P>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>A</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: matrix, state system matrix</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>C</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: matrix, output system matrix</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>RCND</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: vector of length 4,  condition numbers of the matrices involved in rank decision</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    finds the system matrices A and C of a discrete-time system, given the
    system order and the relevant part of the R factor of the concatenated
    block-Hankel matrices, using subspace identification techniques (MOESP 
    or N4SID).
  </P>
    <DESCRIPTION_INDENT>
      <DESCRIPTION_ITEM label="*">
        <SP>[A,C] = findAC(S,N,L,R,METH,TOL,PRINTW)  computes the system matrices A and C. The model structure is:       x(k+1) = Ax(k) + Bu(k) + Ke(k),   k &gt;= 1,      y(k)   = Cx(k) + Du(k) + e(k),  where x(k) and y(k) are vectors of length N and L, respectively.</SP>
      </DESCRIPTION_ITEM>
      <DESCRIPTION_ITEM label="*">
        <SP>[A,C,RCND] = findAC(S,N,L,R,METH,TOL,PRINTW)  also returns the vector RCND of length 4 containing the condition numbers of the matrices involved in rank decisions.</SP>
      </DESCRIPTION_ITEM>
    </DESCRIPTION_INDENT>
    <P>
    Matrix R, computed by findR, should be determined with suitable arguments
    METH and JOBD.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
//generate data from a given linear system
A = [ 0.5, 0.1,-0.1, 0.2;
      0.1, 0,  -0.1,-0.1;      
     -0.4,-0.6,-0.7,-0.1;  
      0.8, 0,  -0.6,-0.6];      
B = [0.8;0.1;1;-1];
C = [1 2 -1 0];
SYS=syslin(0.1,A,B,C);
nsmp=100;
U=prbs_a(nsmp,nsmp/5);
Y=(flts(U,SYS)+0.3*rand(1,nsmp,'normal'));

// Compute R
S=15;L=1;
[R,N,SVAL] = findR(S,Y',U');

N=3;
METH=3;TOL=-1;
[A,C] = findAC(S,N,L,R,METH,TOL);
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>findABCD</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>findBD</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>findBDK</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>findR</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>sorder</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>sident</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
