observer - observer design
Obs=observer(Sys,J) returns the observer Obs=syslin(td,A+J*C,[B+J*D,-J],eye(A)) obtained from Sys by a J output injection. (td is the time domain of Sys). More generally, observer returns in Obs an observer for the observable part of linear system Sys: dotx=A x + Bu, y=Cx + Du represented by a syslin list. Sys has nx state variables, nu inputs and ny outputs. Obs is a linear system with matrices [Ao,Bo,Identity], where Ao is no x no, Bo is no x (nu+ny), Co is no x no and no=nx-m.
Input to Obs is [u,y] and output of Obs is:
xhat=estimate of x modulo unobservable subsp. (case flag='pp') or
xhat=estimate of x modulo unstable unobservable subsp. (case flag='st')
case flag='st': z=H*x can be estimated with stable observer iff H*U(:,1:m)=0 and assignable poles of the observer are set to alfa(1),alfa(2),...
case flag='pp': z=H*x can be estimated with given error spectrum iff H*U(:,1:m)=0 all poles of the observer are assigned and set to alfa(1),alfa(2),...
If H satifies the constraint: H*U(:,1:m)=0 (ker(H) contains unobs-subsp. of Sys) one has H*U=[0,H2] and the observer for z=H*x is H2*Obs with H2=H*U(:,m+1:nx) i.e. Co, the C-matrix of the observer for H*x, is Co=H2.
In the particular case where the pair (A,C) of Sys is observable, one has m=0 and the linear system U*Obs (resp. H*U*Obs) is an observer for x (resp. Hx). The error spectrum is alpha(1),alpha(2),...,alpha(nx).
nx=5;nu=1;ny=1;un=3;us=2;Sys=ssrand(ny,nu,nx,list('dt',us,us,un)); //nx=5 states, nu=1 input, ny=1 output, //un=3 unobservable states, us=2 of them unstable. [Obs,U,m]=observer(Sys); //Stable observer (default) W=U';H=W(m+1:nx,:);[A,B,C,D]=abcd(Sys); //H*U=[0,eye(no,no)]; Sys2=ss2tf(syslin('c',A,B,H)) //Transfer u-->z Idu=eye(nu,nu);Sys3=ss2tf(H*U(:,m+1:$)*Obs*[Idu;Sys]) //Transfer u-->[u;y=Sys*u]-->Obs-->xhat-->HUxhat=zhat i.e. u-->output of Obs //this transfer must equal Sys2, the u-->z transfer (H2=eye).