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

  1. function [zf,thf]=idfilt(z,N,Wn,hs)
  2. %IDFILT    Filters data through Butterworth filters
  3. %
  4. %    ZF = idfilt(Z,N,Wn)
  5. %
  6. %    Z  : The output-input data matrix Z = [Y U]. Multi-variable 
  7. %         systems are allowed
  8. %    ZF : The filtered data. The columns of ZF correspond to those of Z.
  9. %    N  : The order of the Butterworth filter to be used.
  10. %    Wn : The cut-off frequency(ies) in fractions of the Nyquist frequency.
  11. %            If Wn is a scalar a Low-Pass filter will be used.
  12. %         If Wn = [Wl Wh] a Band-Pass filter with pass-band  Wn will be used
  13. %
  14. %    With ZF = idfilt(Z,N,Wn,'high') or ZF = idfilt(Z,N,[Wl Wh],'stop')
  15. %    High-Pass and Band-Stop filters will be used instead. (Same syntax as
  16. %    for the command BUTTER)
  17. %
  18. %    With [ZF,THFILT] = idfilt(Z,N,Wn), also the filter will be returned
  19. %     in the THETA-format as THFILT. (See help theta).
  20.  
  21. %    L. Ljung 10-1-89
  22. %    Copyright (c) 1989-90 by the MathWorks, Inc.
  23. %    All Rights Reserved.
  24.  
  25. if ~exist('butter'),error('This routine requires the SIGNAL PROCESSING TOOLBOX!'),end 
  26. [ndat,nyu]=size(z);
  27. if nargin==3,eval('[b,a]=butter(N,Wn);'), else eval('[b,a]=butter(N,Wn,''hey'');')
  28. end
  29. for k=1:nyu
  30. eval('zf(:,k)=filtfilt(b,a,z(:,k));')
  31. end
  32. if nargout>1, thf=mktheta(a,b);end
  33.  
  34.