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

  1. function [t1,e,el,vlc,w,V1,c,d,h,st]=searchbj(z,t,g,lim,V,nb,nc,nd,nf,nk,ni)
  2. %SEARCHBJ searches for lower values of the prediction error criterion
  3. %
  4. %    [T1,E,EL,V,W,V1,C,D,H,ST] = searchbj(Z,T,G,LIM,V,NB,NC,ND,NF,NK)
  5. %
  6. %    The routine searches for a lower value than V of the prediction error
  7. %    criterion for the Box-Jenkins model, starting at T, looking 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, D and H (=C*F) are the poly-
  10. %    nomials associated with T1, and E, EL, V and W are filtered data
  11. %    sequences. The routine is to be used as a subroutine to BJ. See
  12. %    BJ for an explanation of the other arguments.
  13.  
  14. %    L. Ljung 10-1-86
  15. %    Copyright (c) 1986 by the MathWorks, Inc.
  16. %    All Rights Reserved.
  17.  
  18. l=0;,k=1;V1=V+1; n=nb+nc+nd+nf; st=0;
  19. [mz,nz]=size(z(:,1));
  20. ll=ones(mz,nz)*lim;
  21. while [V1 > V l<10],
  22. t1=t+k*g; if l==9,t1=t;end
  23.       c=fstab([1 t1(nb+1:nb+nc)']);t1(nb+1:nb+nc)=c(2:nc+1)';
  24.       f=fstab([1 t1(nb+nc+nd+1:n)']);t1(nb+nc+nd+1:n)=f(2:nf+1)';
  25.       h=conv(c,f);
  26.       d=[1 t1(nb+nc+1:nb+nc+nd)']; 
  27.       b=[zeros(1,nk) t1(1:nb)'];
  28.      w=filter(b,f,z(:,2)); vlc=z(:,1)-w; e=pefilt(d,c,vlc,zeros(ni,1));
  29.      el=max(min(e,ll),-ll);
  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.