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

  1. function [G,PV]=trfsd(th,nnu,w,nny)
  2. %TRFSD    Computes a model's frequency function,along with its standard deviation
  3. %
  4. %    G = trfsd(TH)  or  [G,NSP] = trfsd(TH)
  5. %
  6. %    TH: A matrix defining a model, as described in HELP THETA
  7. %    G is returned as the transfer function estimate, and NSP (if specified)
  8. %    as the noise spectrum, corresponding to the model TH. These matrices
  9. %    contain also estimated standard deviations, calculated from the
  10. %    covariance matrix in TH, and are  of the standard frequency function
  11. %    format (see HELP FREQFUNC).If TH describes a time series, G is returned
  12. %    as its spectrum.
  13. %    
  14. %    If the model TH has several inputs, G will be returned as the transfer
  15. %    functions of selected inputs # j1 j2 .. jk by 
  16. %    G = trfsd(TH,[j1 j2 ... jk])  [default is all inputs]. The functions 
  17. %    are computed at 128 equally spaced frequency-values between 0(excluded)
  18. %    and pi/T, where T is the sampling interval specified by TH. The func-
  19. %    tions can be computed at arbitrary frequencies w (a row vector, gene-
  20. %    rated e.g. by LOGSPACE) by G = th2ff(TH,ku,w). The transfer function
  21. %    can be plotted by BODEPLOT. bodeplot(trfsd(TH),sd) is a possible 
  22. %    construction. If the model TH has several outputs, G will be returned
  23. %    as the frequency function at selected outputs ky (a row vector) by
  24. %    G=trf(TH,ku,w,ky); (Default is all outputs).
  25.  
  26. %    L. Ljung 7-7-87, 3-25-89
  27. %    Copyright (c) 1987-90 by the MathWorks, Inc.
  28. %    All Rights Reserved.
  29.  
  30. T=gett(th);
  31.  
  32. % *** Set up default values ***
  33. if nargin<4, nny=[];end
  34. if nargin<3, w=[];end
  35. if nargin<2 , nnu=[];end
  36. if T>0,wdef=pi*[1:128]/128/T;
  37. else wdef=logspace(log10(pi/abs(T)/100),log10(10*pi/abs(T)),128);end
  38.  
  39. if isempty(w),w=wdef;end
  40. if length(w)==1, if w<0, w=wdef;end,end
  41. if isempty(nnu),nnu=1:th(1,3);end
  42. if nargout==1, G=th2ff(th,nnu,w,nny);else [G,PV]=th2ff(th,nnu,w,nny);end
  43.