pub struct TransferFunction {
pub num: Vec<f64>,
pub den: Vec<f64>,
}Expand description
A single-input single-output transfer function N(s) / D(s), coefficients highest-degree
first (e.g. s + 1 is [1.0, 1.0]). D must be nonzero-leading (degree = den.len() - 1)
and deg(N) <= deg(D) — a proper transfer function; this is what every realizable
continuous-time physical system is.
Fields§
§num: Vec<f64>§den: Vec<f64>Implementations§
Source§impl TransferFunction
impl TransferFunction
pub fn new(num: Vec<f64>, den: Vec<f64>) -> Result<Self, TransferFunctionError>
Sourcepub fn to_state_space(&self) -> StateSpace
pub fn to_state_space(&self) -> StateSpace
Realizes this transfer function in controllable canonical form.
D(s) = s^n + a_{n-1} s^{n-1} + ... + a_0 (monic, after normalizing by the original
leading coefficient). If deg(N) == n, one step of polynomial long division extracts
the direct feedthrough d = N[0] (after normalization) and leaves a strictly proper
remainder R(s) = b_{n-1} s^{n-1} + ... + b_0; otherwise d = 0 and R = N.
A = [ 0 1 0 ... 0 ] B = [0]
[ 0 0 1 ... 0 ] [0]
[ ... ] [...]
[ 0 0 0 ... 1 ] [0]
[-a_0 -a_1 -a_2 ... -a_{n-1}] [1]
C = [b_0, b_1, ..., b_{n-1}] D = [d]Verified against a first-order case by hand (docs/tests): for 1/(s+1), this gives
exactly A=[[-1]], B=[[1]], C=[[1]], D=[[0]], the textbook single-state realization.
Trait Implementations§
Source§impl Clone for TransferFunction
impl Clone for TransferFunction
Source§fn clone(&self) -> TransferFunction
fn clone(&self) -> TransferFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more