home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 8.ddi / SIGNAL.DI$ / FREQS.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  979 b   |  29 lines

  1. function h = freqs(b,a,w)
  2. %FREQS    Laplace-transform (s-domain) frequency response.  
  3. %    H = FREQS(B,A,W) returns the complex frequency response vector H 
  4. %    of the filter B/A:
  5. %                         nb-1      nb-2
  6. %         B(s)   b(1)s  +  b(2)s   + ... +  b(nb)
  7. %      H(s) = ---- = --------------------------------
  8. %                         na-1      na-2
  9. %         A(s)   a(1)s  +  a(2)s   + ... +  a(na)
  10. %
  11. %    given the numerator and denominator coefficients in vectors B and A. 
  12. %    The frequency response is evaluated at the points specified in 
  13. %    vector W.  The magnitude and phase can be graphed with:
  14. %
  15. %             w = logspace(d1,d2);
  16. %             h = freqs(b,a,w);
  17. %             mag = abs(h);   phase = angle(h)*180/pi;
  18. %             loglog(w,mag), semilogx(w,phase)
  19. %
  20. %    See also LOGSPACE, POLYVAL, INVFREQS, and FREQZ.
  21.  
  22. %     J.N. Little 6-26-86
  23. %    Copyright (c) 1985, 1986 by the MathWorks, Inc.
  24. %    Last revised 6-25-86 JNL
  25.  
  26. s = sqrt(-1)*w;
  27. h = polyval(b,s) ./ polyval(a,s);
  28.  
  29.