summaryrefslogtreecommitdiffstats
path: root/pbhtest.m
diff options
context:
space:
mode:
Diffstat (limited to 'pbhtest.m')
-rw-r--r--pbhtest.m8
1 files changed, 4 insertions, 4 deletions
diff --git a/pbhtest.m b/pbhtest.m
index f56aa21..546bbc6 100644
--- a/pbhtest.m
+++ b/pbhtest.m
@@ -1,4 +1,4 @@
-% Do A PBH test on system. Given SYS returns:
+% Do A PBH test on system. Given a state space model SYS returns:
%
% - Nr. of states
% - Nr. of stable states
@@ -23,9 +23,9 @@ end
% Check system controllability / stabilizability
Wc = ctrb(sys);
nctrb = rank(Wc);
+nustab = 0;
if nctrb < nx
% Is the system at least stabilizable?
- nustab = 0;
for i = 1:nx
if real(eigvals(i)) >= 0
% PBH test
@@ -40,13 +40,13 @@ end
% Check system observability / detectability
Wo = obsv(sys);
nobsv = rank(Wo);
+nudetb = 0;
if nobsv < nx
% is the system at least detectable?
- nudetb = 0;
for i = 1:nx
if real(eigvals(i)) >= 0
% PBH test
- W = [sys.C; (sys.A - eigvals(i) * eye(nx))];
+ W = [(sys.A' - eigvals(i) * eye(nx)), sys.C'];
if rank(W) < nx
nudetb = nudetb + 1;
end