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

  1. function [t1,e,el,V1,c,st]=searchax(z,t,g,lim,V,na,nb,nc,nk,ni)
  2. %SEARCHAX searches for lower values of the prediction error criterion.
  3. %
  4. %    [T1,E,EL,V1,C,ST] = searchax(Z,T,G,LIM,V,NA,NB,NC,NK)
  5. %
  6. %    The routine searches for a lower value of the prediction erro cri-
  7. %    terion for the armax model, starting at T, loking in the
  8. %    G-direction. T1 is returned as the parameters that give a lower value V1
  9. %    If no lower value is found, ST=1, C is the C-polynomial associated 
  10. %    with T1, and E, EL are the filtered data sequences.
  11. %    The routine is to be used as a subroutine to ARMAX. See
  12. %    ARMAX for an explanation of the other arguments.
  13.  
  14. %    L. Ljung 10-1-86,1-25-92
  15. %    Copyright (c) 1986-92 by the MathWorks, Inc.
  16. %    All Rights Reserved.
  17.  
  18. l=0;,k=1;V1=V+1; n=na+nb+nc; st=0;
  19. [mmz,nnz]=size(z(:,1));
  20. ll=ones(mmz,nnz)*lim;
  21. while [V1 > V l<10],
  22. t1=t+k*g; if l==9,t1=t;end
  23. c=fstab([1 t1(na+nb+1:n).']); t1(na+nb+1:n)=c(2:nc+1).';
  24.  
  25.      a=[1 t1(1:na).']; 
  26.      b=[zeros(1,nk) t1(na+1:na+nb).'];
  27.      e=pefilt(a,c,z(:,1)); if nb>0, e=e-pefilt(b,c,z(:,2),e(1:ni));end
  28.      if lim==0,el=e;else la=abs(e)+eps*ll;el=e.*(min(la,ll)./la);end
  29.  
  30.      V1=e'*el/(length(e)-ni);
  31.  
  32. home, disp(int2str(l))
  33. k=k/2;
  34. l=l+1; if l==10,st=1;end
  35. end
  36.  
  37.