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

  1. function [a,b,c,d,k,x0,da,db,dc,dd,dk,dx0]=th2ss(th)
  2. %TH2SS    Transforms a model in THETA-format to state-space
  3. %
  4. %    [A,B,C,D,K,X0]=th2ss(TH)
  5. %
  6. %    TH: The model, defined in the THETA format (see help theta).
  7. %    A,B,C,D,K,X0 : The matrices in the state-space description 
  8. %    
  9. %    Xn = A X + B u + K e       X0 initial value
  10. %    y  = C X + D u + e
  11. %     
  12. %    Here Xn is the derivative of X or the next value of X, depending
  13. %    on whether TH is denoted as continuous or discrete time.
  14. %
  15. %    With [A,B,C,D,K,X0,dA,dB,dC,dD,dK,dX0]=th2ss(TH) also the
  16. %    standard deviations of the matrix elements are computed.
  17.  
  18. %    L. Ljung 10-2-90
  19. %    Copyrigth (c) 1990 by the MathWorks, Inc.
  20. %    All rights reserved.
  21.  
  22. T=th(1,2);
  23. if isthss(th), if nargout<7, eval('[a,b,c,d,k,x0]=eta2ss(th);'),
  24. else eval('[a,b,c,d,k,x0,da,db,dc,dd,dk,dx0]=eta2ss(th);'),end,return,end
  25. [a,b,c,d,k,x0]=th2ssaux(th);
  26.  
  27. if nargout>6,
  28. % This assumes that TH does not use both an A-polynomial and F/D polynomials
  29. [thpar,p]=th2par(th);
  30. thpar=thpar+sqrt(diag(p))';
  31. th(3,1:length(thpar))=thpar;
  32. [a1,b1,c1,d1,k1,x01]=th2ssaux(th);
  33. da=abs(a-a1);db=abs(b-b1);dc=abs(c-c1);dd=abs(d-d1);dk=abs(k-k1);
  34. dx0=abs(x0-x01);end
  35.  
  36.