X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=octave_packages%2Ftsa-4.2.4%2Fhup.m;fp=octave_packages%2Ftsa-4.2.4%2Fhup.m;h=2321d8e1520826481359a94c426d53b205e06e04;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hp=0000000000000000000000000000000000000000;hpb=1705066eceaaea976f010f669ce8e972f3734b05;p=CreaPhase.git diff --git a/octave_packages/tsa-4.2.4/hup.m b/octave_packages/tsa-4.2.4/hup.m new file mode 100644 index 0000000..2321d8e --- /dev/null +++ b/octave_packages/tsa-4.2.4/hup.m @@ -0,0 +1,53 @@ +function b=hup(C) +%HUP(C) tests if the polynomial C is a Hurwitz-Polynomial. +% It tests if all roots lie in the left half of the complex +% plane +% B=hup(C) is the same as +% B=all(real(roots(c))<0) but much faster. +% The Algorithm is based on the Routh-Scheme. +% C are the elements of the Polynomial +% C(1)*X^N + ... + C(N)*X + C(N+1). +% +% HUP2 works also for multiple polynomials, +% each row a poly - Yet not tested +% +% REFERENCES: +% F. Gausch "Systemtechnik", Textbook, University of Technology Graz, 1993. +% Ch. Langraf and G. Schneider "Elemente der Regeltechnik", Springer Verlag, 1970. + +% $Id: hup.m 5090 2008-06-05 08:12:04Z schloegl $ +% Copyright (c) 1995-1998,2008 by Alois Schloegl +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see . + +[lr,lc] = size(c); + +% Strip leading zeros and throw away. + % not considered yet +%d=(c(:,1)==0); + +% Trailing zeros mean there are roots at zero +b=(c(:,lc)~=0); +lambda=b; + +n=zeros(lc); +if lc>3 + n(4:2:lc,2:2:lc-2)=1; +end; +while lc>1 + lambda(b)=c(b,1)./c(b,2); + b = b & (lambda>=0) & (lambda