home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / r / rlab / CTB / ltifr < prev    next >
Encoding:
Text File  |  1995-11-15  |  847 b   |  35 lines

  1. //--------------------------------------------------------------------
  2. //
  3. // ltifr
  4. //
  5. // syntax: g=ltifr(A,B,S)
  6. //
  7. // This routine computes the Linear time-invariant frequency response
  8. // kernel. Calling the routine as g=ltifr(A,B,S) computes the frequency
  9. // response of the following system:
  10. //
  11. //    g(s) = (sI-A)\b
  12. //
  13. // for the complex frequencies contained in the vector S. The column
  14. // vector B must have as many rows as the matrix A. The results g is
  15. // returned with size(A) rows and length(S) columns.
  16. //
  17. // Copyright (C), by Jeffrey B. Layton, 1994
  18. // Version JBL 931011
  19. //--------------------------------------------------------------------
  20.             
  21. ltifr = function(a,b,s)
  22. {
  23.    local(ns,na,e,g)
  24.  
  25.    ns=length(s);
  26.    na=length(a);
  27.    e=eye(na,na);
  28.    for (i in 1:ns) {
  29.         g[;i] = (s[i]*e-a)\b;
  30.    }
  31.    g=g.';
  32.  
  33.    return g
  34. };
  35.