sident - discrete-time state-space realization and Kalman gain
Default: printw = 0.
SIDENT function for computing a discrete-time state-space realization (A,B,C,D) and Kalman gain K using SLICOT routine IB01BD.
[A,C,B,D] = sident(meth,1,s,n,l,R)
[A,C,B,D,K,Q,Ry,S,rcnd] = sident(meth,1,s,n,l,R,tol,t)
[A,C] = sident(meth,2,s,n,l,R)
B = sident(meth,3,s,n,l,R,tol,0,Ai,Ci)
[B,K,Q,Ry,S,rcnd] = sident(meth,3,s,n,l,R,tol,t,Ai,Ci)
[B,D] = sident(meth,4,s,n,l,R,tol,0,Ai,Ci)
[B,D,K,Q,Ry,S,rcnd] = sident(meth,4,s,n,l,R,tol,t,Ai,Ci)
SIDENT computes a state-space realization (A,B,C,D) and the Kalman predictor gain K 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, N4SID, or their combination).
The model structure is :
x(k+1) = Ax(k) + Bu(k) + Ke(k), k >= 1,
y(k) = Cx(k) + Du(k) + e(k),
where x(k) is the n-dimensional state vector (at time k),
u(k) is the m-dimensional input vector,
y(k) is the l-dimensional output vector,
e(k) is the l-dimensional disturbance vector,
and A, B, C, D, and K are real matrices of appropriate dimensions.
1. The n-by-n system state matrix A, and the p-by-n system output matrix C are computed for job <= 2.
2. The n-by-m system input matrix B is computed for job <> 2.
3. The l-by-m system matrix D is computed for job = 1 or 4.
4. The n-by-l Kalman predictor gain matrix K and the covariance matrices Q, Ry, and S are computed for t > 0.
//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'));
S = 15;
N = 3;
METH=1;
[R,N1] = findR(S,Y',U',METH);
[A,C,B,D,K] = sident(METH,1,S,N,1,R);
SYS1=syslin(1,A,B,C,D);
SYS1.X0 = inistate(SYS1,Y',U');
Y1=flts(U,SYS1);
xbasc();plot2d((1:nsmp)',[Y',Y1'])
METH = 2;
[R,N1,SVAL] = findR(S,Y',U',METH);
tol = 0;
t = size(U',1)-2*S+1;
[A,C,B,D,K] = sident(METH,1,S,N,1,R,tol,t)
SYS1=syslin(1,A,B,C,D)
SYS1.X0 = inistate(SYS1,Y',U');
Y1=flts(U,SYS1);
xbasc();plot2d((1:nsmp)',[Y',Y1'])
V. Sima, Research Institute for Informatics, Bucharest, Oct. 1999. Revisions: May 2000, July 2000.