pub struct StateSpaceModel {
pub a: Vec<Vec<f64>>,
pub b: Vec<Vec<f64>>,
pub c: Vec<Vec<f64>>,
pub d: Vec<Vec<f64>>,
pub state: Vec<f64>,
pub is_discrete: bool,
}Expand description
Continuous or discrete linear state-space model: ẋ = Ax + Bu, y = Cx + Du.
Fields§
§a: Vec<Vec<f64>>State matrix (n×n).
b: Vec<Vec<f64>>Input matrix (n×m).
c: Vec<Vec<f64>>Output matrix (p×n).
d: Vec<Vec<f64>>Feedthrough matrix (p×m).
state: Vec<f64>Current state vector (length n).
is_discrete: boolWhether this model is discrete-time.
Implementations§
Source§impl StateSpaceModel
impl StateSpaceModel
Sourcepub fn new(
a: Vec<Vec<f64>>,
b: Vec<Vec<f64>>,
c: Vec<Vec<f64>>,
d: Vec<Vec<f64>>,
) -> Self
pub fn new( a: Vec<Vec<f64>>, b: Vec<Vec<f64>>, c: Vec<Vec<f64>>, d: Vec<Vec<f64>>, ) -> Self
Create a new state-space model.
Sourcepub fn step(&mut self, u: &[f64], dt: f64) -> Vec<f64>
pub fn step(&mut self, u: &[f64], dt: f64) -> Vec<f64>
Step the continuous system using Euler integration; returns output y.
Sourcepub fn discretize_zoh(&self, dt: f64) -> Self
pub fn discretize_zoh(&self, dt: f64) -> Self
Discretize using zero-order hold (ZOH) approximation.
Trait Implementations§
Source§impl Clone for StateSpaceModel
impl Clone for StateSpaceModel
Source§fn clone(&self) -> StateSpaceModel
fn clone(&self) -> StateSpaceModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StateSpaceModel
impl RefUnwindSafe for StateSpaceModel
impl Send for StateSpaceModel
impl Sync for StateSpaceModel
impl Unpin for StateSpaceModel
impl UnsafeUnpin for StateSpaceModel
impl UnwindSafe for StateSpaceModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.