home *** CD-ROM | disk | FTP | other *** search
- function ms = canform(pseudobsind,nu,x0)
- %CANFORM Constructs canonical form model structures
- %
- % MS = canform(PSEUDOBSIND,NU,X0)
- %
- % MS: The resulting model structure, to be used e.g. in MS2TH
- % PSEUDOBSIND: The pseudo-observability indices, defining the
- % structure. See e.g. Ljung(1987), Appendix 4.A
- % NU: The number of inputs
- % X0: The initial state. Could be fixed, or parametrized. In
- % the latter case NaN is entered in the corresponding entries.
- % The default value of X0 is all zeros
- %
- % It may be difficult to find reasonable initial parameter estimates.
- % Use in that case CANSTART.
- %
- % See also MS2TH and MODSTRUC
-
- % L. Ljung 10-2-1990
- % Copyright (c) 1990 by the MathWorks, Inc.
- % All Rights Reserved
-
- ny=length(pseudobsind);
- nx=sum(pseudobsind);
- if nargin < 3 x0=zeros(nx,1);end
-
- r=cumsum(pseudobsind);
-
- a=[zeros(nx,1),[eye(nx-1);zeros(1,nx-1)]];
-
- for kl=r
- a(kl,:)=NaN*ones(1,nx);
- end
- b=NaN*ones(nx,nu);
- k=NaN*ones(nx,ny);
- c=zeros(ny,nx);
- c(1,1)=1;
- for kl=2:ny
- c(kl,r(kl-1)+1)=1;
- end
- d=zeros(ny,nu);
- ms=modstruc(a,b,c,d,k,x0);
-
-