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

  1. function b = polystab(a);
  2. %POLYSTAB Polynomial stabilization.
  3. %    POLYSTAB(A), where A is a vector of polynomial coefficients,
  4. %    stabilizes the polynomial with respect to the unit circle;
  5. %    roots whose magnitudes are greater than one are reflected
  6. %    inside the unit circle.
  7.  
  8. %    Copyright (c) 1985-1988 by the MathWorks, Inc.
  9. %    Revised 7-25-89 JNL (Handles roots at zero)
  10.  
  11. if length(a) == 1, b = a; return, end
  12. v = roots(a); i = find(v~=0);
  13. vs = 0.5*(sign(abs(v(i))-1)+1);
  14. v(i) = (1-vs).*v(i) + vs./conj(v(i));
  15. b = a(1)*poly(v);
  16.  
  17. % Return only real coefficients if input was real:
  18. if ~any(imag(a))
  19.     b = real(b);
  20. end
  21.