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

  1. function [Ncap,d]=getncap(th)
  2. % GETNCAP     Gets the number of data points and the number of parameters
  3. %        for a model
  4. %
  5. %    [Ncap,D]=getncap(TH);
  6. %
  7. %    TH: The model, defined in the THETA-format (See help theta)
  8. %    Ncap: The number of data points (samples) that were used to estimate TH
  9. %       (If the model is not estimated, Ncap is returned as [])
  10. %    D: The number of estimated parameters in the model structure
  11.  
  12. %    L. Ljung 10-2-90
  13. %    Copyright (c) 1990 by the MathWorks, Inc.
  14. %    All Rights Reserved.
  15.  
  16.  
  17. if isthss(th), d=th(1,5);else nu=th(1,3);
  18. d=th(1,4)+sum(th(1,5:4+nu))+th(1,5+nu)+th(1,6+nu)+sum(th(1,7+nu:6+2*nu));end
  19.  
  20. alpha=(th(2,1)-th(1,1))/(th(2,1)+th(1,1));
  21. if alpha>eps,Ncap=d/alpha;end
  22.  
  23.  
  24.  
  25.