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

  1. function a = kratio(m)
  2. %KRATIO    Utility function for use with ELLIP.
  3. %    KRATIO is a function used to calculate the zeros of an
  4. %    elliptic filter.  It is used with FMINS to find a
  5. %    parameter m satisfying ellipke(m)/ellipke(1-m) = krat.
  6.  
  7. global ELLIP_KRAT;
  8. krat = ELLIP_KRAT;
  9. % to ensure we don't call ellipke(1) which is inf on non-ieee machines
  10. % and that we only call with positive m.
  11. m = min(1,max(m,0));
  12. if abs(m) > eps(1) & abs(m)+eps(1) < 1
  13.     k = ellipke([m,1-m]);
  14.     r = k(1)./k(2) - krat;
  15. elseif abs(m) <= eps(1)    % m==0
  16.     r = -krat;
  17. else    % m==1 => r == inf, but can't for non-ieee machines
  18.     r = 1e20;
  19. end
  20. a = abs(r);
  21.