## Quiz on State Space Models

1. Why is it an advantage to put equations into state space form?

$$\dot x = A x + B u$$

$$y = C x + D u$$

A. Stability analysis
Correct. The eigenvalues of the A matrix determine system stability
B. Nonlinear equations are more easily analyzed
Incorrect. State space models are linear
C. It is a compact way to express systems with multiple inputs and multiple outputs
Correct. The A, B, C, D matrices are the only things needed to express a multiple inputs and multiple outputs in state space form
D. The model is in time-domain that is more intuitive than other forms such as Laplace domain
Correct. Time-domain models are more intuitive because the states represent underlying process variables that affect the dynamics of the output. There is also a suite of linear systems theory and predictive controllers that have been designed with a state space model as the starting point.

2. Which of the following equations is equivalent to the state space model with A=-5, B=2, C=1, and D=0?

$$\dot x = A x + B u$$

$$y = C x + D u$$

A. 5{dy}/{dt} = y + 2u
Incorrect. {dy}/{dt} = -5y + 2u
B. 5{dy}/{dt} = 25y + 10u
Incorrect. {dy}/{dt} = -5y + 2u
C. {dy}/{dt} = -5y + 2u
Correct. Yes
D. 5{dy}/{dt} + 5y = 2u
Incorrect. {dy}/{dt} = -5y + 2u

3. Which of the exercises have multiple states?

A. First order differential equation

$$3 \, \frac{dx}{dt} + 12 \, x = 6 \, u$$ $$y = x$$

B. Second order differential equations

$$2 \frac{dx_1}{dt} + 6 \, x_1 = 8 \, u$$ $$3 \frac{dx_2}{dt} + 6 \, x_1 + 9 \, x_2 = 0$$ $$y = \frac{x_1 + x_2}{2}$$

C. Second order differential equation

$$4 \frac{d^2y}{dt^2} + 2 \frac{dy}{dt} + y = 3 \, u$$

D. Nonlinear differential equations

$$2 \frac{dx_1}{dt} + x_1^2 + 3 \, x_2^2 = 16 \, u$$ $$3 \frac{dx_2}{dt} + 6 \, x_1^2 + 6 \, x_2^2 = 0$$ $$y_1 = x_2$$ $$y_2 = x_1$$

$$\bar u = 1, \quad \bar x = \begin{bmatrix}2\\2\end{bmatrix}$$

A
Incorrect. This is the only exercise with only one state
B and D
Incorrect. C has two states. It can be reformulated into a system of differential equations.
B
Incorrect. C and D have two states (x_1 and x_2)
B, C, and D
Correct. B, C, and D have two states (x_1 and x_2).

4. The A matrix of a state space model has eigenvalues: [0.45+/-2.1i, -3.1].

$$A = \begin{bmatrix} -0.2 & -1 & 0.6\\ 5.0 & 1.0 & -0.7\\ 1.0 & 0 & -3.0 \end{bmatrix}$$

What conclusion can be drawn about the system stability and oscillations?

A. Converges with no oscillations
Incorrect. There is a non-negative real part of an eigenvalue
B. Converges with oscillations
Incorrect. There are imaginary parts to the eigenvalues so there are oscillations. However, there is a positive real part to at least one eigenvalue so the system response diverges and is not stable.
C. Diverges with oscillations
Correct. There are imaginary parts to the eigenvalues and a positive real part to at least one eigenvalue so the system response diverges and is not stable.
Verification
import numpy as np
A = [[-0.2,-1,0.6],[5.0,1.0,-0.7],[1.0,0,-3.0]]
B = [[1],[0],[0]]; C = [0.5,0.5,0.5]; D = [0]
print(np.linalg.eig(A)[0])

from scipy import signal
sys1 = signal.StateSpace(A,B,C,D)
t1,y1 = signal.step(sys1)

import matplotlib.pyplot as plt
plt.figure(1)
plt.plot(t1,y1,'r-',label='y')
plt.legend()
plt.xlabel('Time')
plt.show()
D. Diverges with no oscillations
Incorrect. There are imaginary parts to the eigenvalues and a positive real part to at least one eigenvalue so the system response diverges and is not stable.