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

  1. function thn=sett(th,T);
  2. %SETT    Sets the sampling interval in TH-structures
  3. %    or for frequency functions generated by spa, etfe, th2ff, or trf
  4. %    with a default choice of frequencies.
  5. %
  6. %    THN = sett(TH,T)  or GN = sett(G,T)
  7. %
  8. %    TH:  The original model in THETA-format
  9. %    T:   The sampling interval
  10. %    THN: The new model in THETA-format, with sampling interval T 
  11. %    or
  12. %    G:   The original frequency function
  13. %    GN:  The frequency function with frequencies scaled according to
  14. %         the desired sampling interval
  15.  
  16. %    L. Ljung 10-2-90
  17. %       Revised 21-4-91
  18. %    Copyright (c) 1990 by the MathWorks, Inc.
  19. %    All Rights Reserved.
  20.  
  21. [nr,nc]=size(th);thn=th;
  22. if nr==129
  23.     test=rem(th(1,:),1000); tt=test(1);
  24.     if floor(tt)==tt & tt>=100 & tt<=119 %Then we have freqfunc case
  25.     freqind=find(test>=100);
  26.     spind=find(test==0);sdind=find(test==50);frspind=find(test==100);
  27.     Tcurrent=(ones(1,length(freqind))*pi)./th(129,freqind);
  28.     Tspc=(ones(1,length(frspind))*pi)./th(129,frspind);
  29.     thn(2:129,freqind)=thn(2:129,freqind).*(ones(128,1)*Tcurrent)/T;
  30.     if ~isempty(spind)
  31.       thn(2:129,spind)=thn(2:129,spind)./(ones(128,1)*Tspc)*T;
  32.     end
  33.     if ~isempty(sdind)
  34.       thn(2:129,sdind)=thn(2:129,sdind)./(ones(128,1)*Tspc)*T;
  35.     end
  36. end,else
  37. if isthss(th),if any(th(2,8)==[1 5]),thn(1,2)=-abs(T);else thn(1,2)=T;end,
  38. else
  39. thn(1,2)=T;
  40. end
  41. end
  42.