Skip to content

Commit 6567c2c

Browse files
committed
[test-statefdk.py] Refactor style and imports
1 parent 5b25bf6 commit 6567c2c

File tree

2 files changed

+37
-29
lines changed

2 files changed

+37
-29
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
""" check-controllability-and-observability.py
2+
3+
Example to check the controllability and the observability of a state space system.
4+
RMM, 6 Sep 2010
5+
"""
6+
7+
from __future__ import print_function
8+
9+
from scipy import * # Load the scipy functions
10+
from control.matlab import * # Load the controls systems library
11+
12+
# Parameters defining the system
13+
14+
m = 250.0 # system mass
15+
k = 40.0 # spring constant
16+
b = 60.0 # damping constant
17+
18+
# System matrices
19+
A = matrix([[1, -1, 1.],
20+
[1, -k / m, -b / m],
21+
[1, 1, 1]])
22+
23+
B = matrix([[0],
24+
[1 / m],
25+
[1]])
26+
27+
C = matrix([[1., 0, 1.]])
28+
29+
sys = ss(A, B, C, 0)
30+
31+
# Check controllability
32+
Wc = ctrb(A, B)
33+
print("Wc = ", Wc)
34+
35+
# Check Observability
36+
Wo = obsv(A, C)
37+
print("Wo = ", Wo)

examples/test-statefbk.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)