home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 9.ddi / IDENT.DI$ / CANFORM.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.1 KB  |  44 lines

  1. function ms = canform(pseudobsind,nu,x0)
  2. %CANFORM Constructs canonical form model structures
  3. %
  4. %    MS = canform(PSEUDOBSIND,NU,X0)
  5. %
  6. %    MS: The resulting model structure, to be used e.g. in MS2TH
  7. %    PSEUDOBSIND: The pseudo-observability indices, defining the
  8. %        structure. See e.g. Ljung(1987), Appendix 4.A
  9. %    NU: The number of inputs
  10. %    X0: The initial state. Could be fixed, or parametrized. In
  11. %    the latter case NaN is entered in the corresponding entries.
  12. %        The default value of X0 is all zeros
  13. %    
  14. %    It may be difficult to find reasonable initial parameter estimates.
  15. %    Use in that case CANSTART.
  16. %
  17. %    See also MS2TH and MODSTRUC
  18.  
  19. %    L. Ljung 10-2-1990
  20. %    Copyright (c) 1990 by the MathWorks, Inc.
  21. %    All Rights Reserved
  22.  
  23. ny=length(pseudobsind);
  24. nx=sum(pseudobsind);
  25. if nargin < 3 x0=zeros(nx,1);end
  26.  
  27. r=cumsum(pseudobsind);
  28.  
  29. a=[zeros(nx,1),[eye(nx-1);zeros(1,nx-1)]];
  30.  
  31. for kl=r
  32.     a(kl,:)=NaN*ones(1,nx);
  33. end
  34. b=NaN*ones(nx,nu);
  35. k=NaN*ones(nx,ny);
  36. c=zeros(ny,nx);
  37. c(1,1)=1;
  38. for kl=2:ny
  39.     c(kl,r(kl-1)+1)=1;
  40. end
  41. d=zeros(ny,nu);
  42. ms=modstruc(a,b,c,d,k,x0);
  43.  
  44.