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

  1. function TH=iv(z,nn,NF,MF,maxsize,T,p)
  2. %IV    Computes instrumental variable estimates for single output ARX-models.
  3. %
  4. %    TH = iv(Z,NN,NF,MF)
  5. %
  6. %    TH: returned as the IV-estimate of the ARX-model
  7. %    A(q) y(t) = B(q) u(t-nk) + v(t)
  8. %    along with relevant structure information. See HELP THETA for
  9. %    the exact structure of TH.
  10. %
  11. %    Z : the output-input data Z=[y u], with y and u as column vectors.
  12. %    For multi-input systems u=[u1 u2 ... un]
  13. %
  14. %    NN: NN=[na nb nk] gives the orders and delays associated with the
  15. %    above model.
  16. %    NF and MF define the instruments X as
  17. %    NF(q) x(t) = MF(q) u(t)
  18. %
  19. %     See IV4 for good, automatic choices of instruments.
  20. %
  21. %    TH=iv(Z,NN,NF,MF,maxsize,T)
  22. %    allows access to some parameters associated with the algorithm.
  23. %    See HELP AUXVAR for an explanation of these.
  24.  
  25. %    L. Ljung 10-1-86
  26. %    Copyright (c) 1986-90 by the MathWorks, Inc.
  27. %    All Rights Reserved.
  28.  
  29. [Ncap,nz]=size(z); nu=nz-1;
  30. na=nn(1);nb=nn(2:1+nu);nk=nn(2+nu:1+2*nu);n=na+sum(nb);
  31. % *** Some initial tests on the input arguments ***
  32. maxsdef=idmsize(Ncap,n);
  33.  
  34. if nargin<7, p=1;end
  35. if nargin<6, T=1;end
  36. if nargin<5, maxsize=maxsdef;end
  37. if T<0,T=1;end,if maxsize<0,maxsize=maxsdef;end
  38. if isempty(T), T=1;end,if isempty(maxsize),maxsize=maxsdef;end
  39. % *** construct instruments (see (7.111)-(7.112)) ***
  40.  
  41.      x=zeros(Ncap,1);
  42.      for k=1:nu
  43.          x=x+filter(MF(k,:),NF,z(:,k+1));
  44.      end
  45. %
  46.  
  47. TH=ivx(z,nn,x,maxsize,T,p);
  48. if p~=0,TH(2,7)=3;end
  49.  
  50.