0%

controllability and observability

1
2
from sympy import *
import numpy as np

Problem 4.1

Determine whether the following continuous-time linear time-invariant system is fully controllable \[ \dot{x} = \begin{bmatrix} 0 & 1 & 0 \\\ 0 & 0 & 1 \\\ -2 & -4 & -3 \\\ \end{bmatrix} x+ \begin{bmatrix} 1 & 0 \\\ 0 & 1 \\\ -1 & 1 \\\ \end{bmatrix} u \]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
A = Matrix([[0, 1, 0], 
[0, 0, 1],
[-2, -4, -3]])
B = Matrix([
[1, 0],
[0, 1],
[-1, 1]
])

Q = B.col_insert(2, A*B).col_insert(5, A**2*B)
if Q.rank()==3:
print("This system is fully controllable")
else:
print("This system is not fully controllable")
This system is fully controllable

Problem 4.2

Determine the range of values a,b,c for the following continuous-time linear time-invariant systems to be fully controllable

\[ \dot{x} = \begin{bmatrix} -2 & 0 & 0 \\\ 0 & -2 & 0 \\\ 0 & 0 & -2 \\\ \end{bmatrix} x+ \begin{bmatrix} a & 1 \\\ 2 & 4 \\\ b & 1 \\\ \end{bmatrix} u \]

1
2
3
4
5
6
7
8
9
10
11
12
a, b= symbols("a b")
A = Matrix([[-2, 0, 0],
[0, -2, 0],
[0, 0, -2]])
B = Matrix([
[a, 1],
[2, 4],
[b, 1]
])

Q = B.col_insert(2, A*B).col_insert(5, A**2*B)
Q

\(\displaystyle \left[\begin{matrix}a & 1 & - 2 a & -2 & 4 a & 4\\\2 & 4 & -4 & -8 & 8 & 16\\\b & 1 & - 2 b & -2 & 4 b & 4\end{matrix}\right]\)

1
2
3
4
if Q.rank()==3:
print("This system is fully controllable")
else:
print("This system is not fully controllable")
This system is not fully controllable

Problem 4.3

Determine whether the following continuous-time linear time-invariant system is fully observable

\[ \dot{x} = \begin{bmatrix} 0 & 1 & 0 \\\ 0 & 0 & 1 \\\ -2 & -4 & -3 \end{bmatrix} x, y= \begin{bmatrix} 1 & 0 & 4 \\\ 2 & 0 & 8 \end{bmatrix} x \]

1
2
3
4
5
6
7
8
9
10
11
12
13
A = Matrix([[0, 1, 0], 
[0, 0, 1],
[-2, -4, -3]])
C = Matrix([
[1, 0, 4],
[2, 0, 8]
])

Q =C.row_insert(3, C*A).row_insert(6, C*A**2)
if Q.rank()==3:
print("This system is fully controllable")
else:
print("This system is not fully controllable")
This system is fully controllable

Problem 4.4

Determine the range of values a,b,c for the following continuous-time linear time-invariant system to be fully observable

\[ \dot{x} = \begin{bmatrix} -2 & 0 & 0 \\\ 1 & -2 & 0\\\ 0 & 0 & -2 \end{bmatrix} x, y= \begin{bmatrix} 1 & a & b \\\ 4 & 0 & 4 \end{bmatrix} x \]

Condition 1: a!=0 or b!=1

1
2
3
4
5
6
7
8
9
10
11
12
# if a!=0 and b!=1:  C.rank()=2, only when rank[C CA]'==3, the conditions are satified
a, b= symbols("a b")
A = Matrix([[-2, 0, 0],
[1, -2, 0],
[0, 0, -2]])
C = Matrix([
[1, a, b],
[4, 0, 4]
])

Q = C.row_insert(3, C*A)
Q

\(\displaystyle \left[\begin{matrix}1 & a & b\\\4 & 0 & 4\\\a - 2 & - 2 a & - 2 b\\\\-8 & 0 & -8\end{matrix}\right]\)

\[ Q=\begin{bmatrix}1 & a & b\\\4 & 0 & 4\\\a - 2 & - 2 a & - 2 b\\\\-8 & 0 & -8\end{bmatrix} \] So, when a is not equal to 0 and b is not equal to 0, this system is fully observable

Condition 2: a==0 and b==1

1
2
3
4
5
6
7
8
9
10
11
# only when rank[C1 C1A C1A^2]'==3, the conditions are satified
a, b= symbols("a b")
A = Matrix([[-2, 0, 0],
[1, -2, 0],
[0, 0, -2]])
C = Matrix([
[1, 0, 1]
])

Q = C.row_insert(3, C*A).row_insert(6, C*A**2)
Q

\(\displaystyle \left[\begin{matrix}1 & 0 & 1\\\\-2 & 0 & -2\\\4 & 0 & 4\end{matrix}\right]\)

rank(Q) = 3, thus in this condition, this system is not fully observable

Problem 4.5

Determine the range of values a,b,c for the following continuous-time linear time-invariant system to be fully controllable and observable

\[ \dot{x} = \begin{bmatrix} -1 & 1 & a \\\ 0 & -2 & 1 \\\ 0 & 0 & -3 \end{bmatrix} x+ \begin{bmatrix} 0 \\\ 0 \\\ 1 \\\ \end{bmatrix} u, y= \begin{bmatrix} 0 & 0 & 1 \end{bmatrix} x \]

Problem 4.6

Calculate the controllability and observability index of the following continuous-time linear time-invariant system

\[ \dot{x} = \begin{bmatrix} 0 & 1 & 0 \\\ 0 & 0 & 1 \\\ 0 & 3 & -1 \end{bmatrix} x+ \begin{bmatrix} 0 & 1 \\\ 1 & 0 \\\ 0 & 0 \end{bmatrix} u, y= \begin{bmatrix} 1 & 0 & 1 \\\ 0 & 1 & 0 \end{bmatrix} x \]

If you like my blog, please donate for me.