<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>ddp</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1993</DATE>
  <SHORT_DESCRIPTION name="ui_observer"> unknown input observer</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>[UIobs,J,N]=ui_observer(Sys,reject,C1,D1)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>[UIobs,J,N]=ui_observer(Sys,reject,C1,D1,flag,alfa,beta)  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>Sys</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: <VERB>syslin</VERB> list containing the matrices <VERB>(A,B,C2,D2)</VERB>.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>reject</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: integer vector, indices of inputs of <VERB>Sys</VERB> which are unknown.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>C1</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: real matrix</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>D1</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: real matrix. <VERB>C1</VERB> and <VERB>D1</VERB> have the same number of rows.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>flag</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: string <VERB>'ge'</VERB> or <VERB>'st'</VERB> (default) or <VERB>'pp'</VERB>.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>alfa</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: real or complex vector (loc. of closed loop poles)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>beta</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: real or complex vector (loc. of closed loop poles)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    Unknown input observer.</P>
    <P><VERB>Sys: (w,u) --&gt; y</VERB> is a <VERB>(A,B,C2,D2)</VERB> syslin linear system with 
    two inputs w and u, w being the unknown input.
    The  matrices B and D2 of Sys are (implicitly) partitioned as:
    <VERB>B=[B1,B2]</VERB> and <VERB>D2=[D21,D22]</VERB>  with <VERB>B1=B(:,reject)</VERB>  and 
    <VERB>D21=D2(:,reject)</VERB> where reject = indices of unknown inputs.
    The matrices <VERB>C1</VERB> and <VERB>D1</VERB> define <VERB>z = C1 x + D1 (w,u)</VERB>,
    the to-be-estimated output.</P>
    <P>
    The matrix <VERB>D1</VERB> is (implicitly) partitioned as <VERB>D1=[D11,D12]</VERB>
    with <VERB>D11=D(:,reject)</VERB></P>
    <P>
    The data (Sys, reject,C1, D1)   define a 2-input 2-output system:</P>
    <VERBATIM>
<![CDATA[
  xdot =  A x + B1  w + B2  u
     z = C1 x + D11 w + D12 u
     y = C2 x + D21 w + D22 u
   ]]>
    </VERBATIM>
    <P>
    An observer <VERB>(u,y) --&gt; zhat</VERB> is looked for the output z.</P>
    <P><VERB>flag='ge'</VERB> no stability constraints
    <VERB>flag='st'</VERB> stable observer    (default) 
    <VERB>flag='pp'</VERB> observer with pole placement
    alfa,beta = desired location of closed loop poles  (default -1, -2)
    J=y-output to x-state injection.
    N=y-output to z-estimated output injection.</P>
    <P>
    UIobs = linear system (u,y) --&gt; zhat such that:
    The transfer function: (w,u) --&gt; z  equals the composed transfer function:
                [0,I;        UIobs
                 Sys]
          (w,u) -----&gt; (u,y) -----&gt; zhat
    i.e. transfer function of system {A,B,C1,D1} equals transfer function 
    <VERB>UIobs*[0,I; Sys]</VERB></P>
    <P>
    Stability (resp. pole placement) requires detectability
    (resp. observability) of (A,C2).</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
A=diag([3,-3,7,4,-4,8]);
B=[eye(3,3);zeros(3,3)];
C=[0,0,1,2,3,4;0,0,0,0,0,1];
D=[1,2,3;0,0,0];
rand('seed',0);w=ss2ss(syslin('c',A,B,C,D),rand(6,6));
[A,B,C,D]=abcd(w);
B=[B,matrix(1:18,6,3)];D=[D,matrix(-(1:6),2,3)];
reject=1:3;
Sys=syslin('c',A,B,C,D);
N1=[-2,-3];C1=-N1*C;D1=-N1*D;
nw=length(reject);nu=size(Sys('B'),2)-nw;
ny=size(Sys('C'),1);nz=size(C1,1);
[UIobs,J,N]=ui_observer(Sys,reject,C1,D1);

W=[zeros(nu,nw),eye(nu,nu);Sys];UIobsW=UIobs*W;   
//(w,u) --> z=UIobs*[0,I;Sys](w,u)
clean(ss2tf(UIobsW));
wu_to_z=syslin('c',A,B,C1,D1);clean(ss2tf(wu_to_z));
clean(ss2tf(wu_to_z)-ss2tf(UIobsW),1.d-7)
/////2nd example//////
nx=2;ny=3;nwu=2;Sys=ssrand(ny,nwu,nx);
C1=rand(1,nx);D1=[0,1];
UIobs=ui_observer(Sys,1,C1,D1);
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>cainv</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>ddp</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>abinv</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
  <AUTHOR>F.D.  </AUTHOR>
</MAN>
