来自Matlab Central,很强大,本文进行了一些改动。
function [RA,s_out] = routh(poli,epsilon);
% ROUTH Routh array.
% [RA,s_out] = ROUTH(R,EPSILON)
returns the symbolic Routh array RA for
% polynomial R(s). s_out
indicates what special cases happen.
% The following special cases are
considered:
% 1) zero first elements and 2)
rows of zeros. All zero first
% elements are replaced with
the symbolic variable EPSILON
% which can be later
substituted with positive and negative
% small numbers using
SUBS(RA,EPSILON,...). When a row of
% zeros is found, the auxiliary
polynomial is used.
%
% Examples:
%
% 1) Routh array for s^5+s^4+2*s^3+2*s^2+s+1
%
% >>syms
EPS
% >>[ra,s]
= routh