cbadc.analog_system.AnalogSystem
- class cbadc.analog_system.AnalogSystem(A: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]], B: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]], CT: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]], Gamma: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]], Gamma_tildeT: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]], D: Optional[Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]] = None)
Bases:
objectRepresents an analog system.
The AnalogSystem class represents an analog system goverened by the differential equations,
\(\dot{\mathbf{x}}(t) = \mathbf{A} \mathbf{x}(t) + \mathbf{B} \mathbf{u}(t) + \mathbf{\Gamma} \mathbf{s}(t)\)
where we refer to \(\mathbf{A} \in \mathbb{R}^{N \times N}\) as the system matrix, \(\mathbf{B} \in \mathbb{R}^{N \times L}\) as the input matrix, and \(\mathbf{\Gamma} \in \mathbb{R}^{N \times M}\) is the control input matrix. Furthermore, \(\mathbf{x}(t)\in\mathbb{R}^{N}\) is the state vector of the system, \(\mathbf{u}(t)\in\mathbb{R}^{L}\) is the vector valued, continuous-time, analog input signal, and \(\mathbf{s}(t)\in\mathbb{R}^{M}\) is the vector valued control signal.
The analog system also has two (possibly vector valued) outputs namely:
The control observation \(\tilde{\mathbf{s}}(t)=\tilde{\mathbf{\Gamma}}^\mathsf{T} \mathbf{x}(t)\) and
The signal observation \(\mathbf{y}(t) = \mathbf{C}^\mathsf{T} \mathbf{x}(t) + \mathbf{C} \mathbf{u}(t)\)
where \(\tilde{\mathbf{\Gamma}}^\mathsf{T}\in\mathbb{R}^{\tilde{M} \times N}\) is the control observation matrix and \(\mathbf{C}^\mathsf{T}\in\mathbb{R}^{\tilde{N} \times N}\) is the signal observation matrix.
- Parameters
A (array_like, shape=(N, N)) – system matrix.
B (array_like, shape=(N, L)) – input matrix.
CT (array_like, shape=(N_tilde, N)) – signal observation matrix.
Gamma (array_like, shape=(N, M)) – control input matrix.
Gamma_tildeT (array_like, shape=(M_tilde, N)) – control observation matrix.
- N
state space order \(N\).
- Type
int
- N_tilde
number of signal observations \(\tilde{N}\).
- Type
int
- M
number of digital control signals \(M\).
- Type
int
- M_tilde
number of control signal observations \(\tilde{M}\).
- Type
int
- L
number of input signals \(L\).
- Type
int
- A
system matrix \(\mathbf{A}\).
- Type
array_like, shape=(N, N)
- B
input matrix \(\mathbf{B}\).
- Type
array_like, shape=(N, L)
- CT
signal observation matrix \(\mathbf{C}^\mathsf{T}\).
- Type
array_like, shape=(N_tilde, N)
- Gamma
control input matrix \(\mathbf{\Gamma}\).
- Type
array_like, shape=(N, M)
- Gamma_tildeT
control observation matrix \(\tilde{\mathbf{\Gamma}}^\mathsf{T}\).
- Type
array_like, shape=(M_tilde, N)
See also
Example
>>> import numpy as np >>> from cbadc.analog_system import AnalogSystem >>> A = np.array([[1, 2], [3, 4]]) >>> B = np.array([[1], [2]]) >>> CT = np.array([[1, 2], [0, 1]]).transpose() >>> Gamma = np.array([[-1, 0], [0, -5]]) >>> Gamma_tildeT = CT.transpose() >>> print(AnalogSystem(A, B, CT, Gamma, Gamma_tildeT)) The analog system is parameterized as: A = [[1. 2.] [3. 4.]], B = [[1.] [2.]], CT = [[1. 0.] [2. 1.]], Gamma = [[-1. 0.] [ 0. -5.]], and Gamma_tildeT = [[1. 2.] [0. 1.]]
- Raises
InvalidAnalogSystemError – For faulty analog system parametrization.
Methods
__init__(A, B, CT, Gamma, Gamma_tildeT[, D])Create an analog system.
Computes the control observation for a given state vector \(\mathbf{x}(t)\) evaluated at time \(t\).
Evaluates the transfer functions between control signals and the system output.
derivative(x, t, u, s)Compute the derivative of the analog system.
Computes the signal observation for a given state vector \(\mathbf{x}(t)\) evaluated at time \(t\).
transfer_function_matrix(omega)Evaluate the analog signal transfer function at the angular frequencies of the omega array.
zpk([input])return zero-pole-gain representation of system
- control_observation(x: numpy.ndarray) numpy.ndarray
Computes the control observation for a given state vector \(\mathbf{x}(t)\) evaluated at time \(t\).
Specifically, returns
\(\tilde{\mathbf{s}}(t) = \tilde{\mathbf{\Gamma}}^\mathsf{T} \mathbf{x}(t)\)
- Parameters
x (array_like, shape=(N,)) – the state vector.
- Returns
the control observation.
- Return type
array_like, shape=(M_tilde,)
- control_signal_transfer_function_matrix(omega: numpy.ndarray) numpy.ndarray
Evaluates the transfer functions between control signals and the system output.
Specifically, evaluates
\(\bar{\mathbf{G}}(\omega) = \mathbf{C}^\mathsf{T} \left(\mathbf{A} - i \omega \mathbf{I}_N\right)^{-1} \mathbf{\Gamma} \in \mathbb{R}^{\tilde{N} \times M}\)
for each angular frequency in omega where \(\mathbf{I}_N\) represents a square identity matrix of the same dimensions as \(\mathbf{A}\) and \(i=\sqrt{-1}\).
- Parameters
omega (array_like, shape=(K,)) – an array_like object containing the angular frequencies for evaluation.
- Returns
the signal transfer function evaluated at K different angular frequencies.
- Return type
array_like, shape=(N_tilde, M, K)
- derivative(x: numpy.ndarray, t: float, u: numpy.ndarray, s: numpy.ndarray) numpy.ndarray
Compute the derivative of the analog system.
Specifically, produces the state derivative
\(\dot{\mathbf{x}}(t) = \mathbf{A} \mathbf{x}(t) + \mathbf{B} \mathbf{u}(t) + \mathbf{\Gamma} \mathbf{s}(t)\)
as a function of the state vector \(\mathbf{x}(t)\), the given time \(t\), the input signal value \(\mathbf{u}(t)\), and the control contribution value \(\mathbf{s}(t)\).
- Parameters
x (array_like, shape=(N,)) – the state vector evaluated at time t.
t (float) – the time t.
u (array_like, shape=(L,)) – the input signal vector evaluated at time t.
s (array_like, shape=(M,)) – the control contribution evaluated at time t.
- Returns
the derivative \(\dot{\mathbf{x}}(t)\).
- Return type
array_like, shape=(N,)
- signal_observation(x: numpy.ndarray) numpy.ndarray
Computes the signal observation for a given state vector \(\mathbf{x}(t)\) evaluated at time \(t\).
Specifically, returns
\(\mathbf{y}(t)=\mathbf{C}^\mathsf{T} \mathbf{x}(t)\)
- Parameters
x (array_like, shape=(N,)) – the state vector.
- Returns
the signal observation.
- Return type
array_like, shape=(N_tilde,)
- transfer_function_matrix(omega: numpy.ndarray) numpy.ndarray
Evaluate the analog signal transfer function at the angular frequencies of the omega array.
Specifically, evaluates
\(\mathbf{G}(\omega) = \mathbf{C}^\mathsf{T} \left(\mathbf{A} - i \omega \mathbf{I}_N\right)^{-1} \mathbf{B} + \mathbf{D}\)
for each angular frequency in omega where \(\mathbf{I}_N\) represents a square identity matrix of the same dimensions as \(\mathbf{A}\) and \(i=\sqrt{-1}\).
- Parameters
omega (array_like, shape=(K,)) – an array_like object containing the angular frequencies for evaluation.
- Returns
the signal transfer function evaluated at K different angular frequencies.
- Return type
array_like, shape=(N_tilde, L, K)
- zpk(input=0)
return zero-pole-gain representation of system
- Parameters
input – determine for which input (in case of L > 1) to compute zpk, defaults to 0.
int – determine for which input (in case of L > 1) to compute zpk, defaults to 0.
optional – determine for which input (in case of L > 1) to compute zpk, defaults to 0.
- Returns
z,p,k the zeros, poles and gain of the system
- Return type
array_like, shape=(?, ?, 1)