annotate extra/tsa/inst/hup.m @ 12580:b6eace8bc216 octave-forge

[tsa] update contact email address
author schloegl
date Thu, 02 Apr 2015 10:00:34 +0000
parents 18ff3d258eea
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2414
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
1 function b=hup(C)
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
2 %HUP(C) tests if the polynomial C is a Hurwitz-Polynomial.
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
3 % It tests if all roots lie in the left half of the complex
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
4 % plane
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
5 % B=hup(C) is the same as
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
6 % B=all(real(roots(c))<0) but much faster.
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
7 % The Algorithm is based on the Routh-Scheme.
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
8 % C are the elements of the Polynomial
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
9 % C(1)*X^N + ... + C(N)*X + C(N+1).
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
10 %
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
11 % HUP2 works also for multiple polynomials,
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
12 % each row a poly - Yet not tested
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
13 %
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
14 % REFERENCES:
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
15 % F. Gausch "Systemtechnik", Textbook, University of Technology Graz, 1993.
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
16 % Ch. Langraf and G. Schneider "Elemente der Regeltechnik", Springer Verlag, 1970.
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
17
4907
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
18 % $Id$
12580
b6eace8bc216 [tsa] update contact email address
schloegl
parents: 4907
diff changeset
19 % Copyright (c) 1995-1998,2008 by Alois Schloegl <alois.schloegl@gmail.com>
4907
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
20 %
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
21 % This program is free software: you can redistribute it and/or modify
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
22 % it under the terms of the GNU General Public License as published by
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
23 % the Free Software Foundation, either version 3 of the License, or
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
24 % (at your option) any later version.
2414
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
25 %
4907
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
26 % This program is distributed in the hope that it will be useful,
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
27 % but WITHOUT ANY WARRANTY; without even the implied warranty of
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
28 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
29 % GNU General Public License for more details.
2414
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
30 %
4907
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
31 % You should have received a copy of the GNU General Public License
18ff3d258eea update license of TSA toolbox to GPLv3
schloegl
parents: 4404
diff changeset
32 % along with this program. If not, see <http://www.gnu.org/licenses/>.
2414
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
33
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
34 [lr,lc] = size(c);
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
35
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
36 % Strip leading zeros and throw away.
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
37 % not considered yet
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
38 %d=(c(:,1)==0);
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
39
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
40 % Trailing zeros mean there are roots at zero
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
41 b=(c(:,lc)~=0);
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
42 lambda=b;
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
43
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
44 n=zeros(lc);
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
45 if lc>3
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
46 n(4:2:lc,2:2:lc-2)=1;
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
47 end;
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
48 while lc>1
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
49 lambda(b)=c(b,1)./c(b,2);
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
50 b = b & (lambda>=0) & (lambda<Inf);
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
51 c=c(:,2:lc)-lambda(:,ones(1,lc-1)).*(c*n(1:lc,1:lc-1));
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
52 lc=lc-1;
19251cd2753b Latest package manager mega patch, but not the last
adb014
parents:
diff changeset
53 end;