pub struct StateSpaceModel {
pub a: Vec<f64>,
pub b: Vec<f64>,
pub c: Vec<f64>,
pub d: Vec<f64>,
pub n: usize,
pub m: usize,
pub p: usize,
pub state: Vec<f64>,
}Expand description
Discrete-time linear state-space model: x[k+1] = Ax[k] + Bu[k], y[k] = Cx[k] + Du[k].
Matrices are stored row-major. Dimensions: A is n×n, B is n×m, C is p×n, D is p×m.
Fields§
§a: Vec<f64>State matrix A (n×n), row-major.
b: Vec<f64>Input matrix B (n×m), row-major.
c: Vec<f64>Output matrix C (p×n), row-major.
d: Vec<f64>Feedthrough matrix D (p×m), row-major.
n: usizeNumber of states n.
m: usizeNumber of inputs m.
p: usizeNumber of outputs p.
state: Vec<f64>Current state vector (length n).
Implementations§
Source§impl StateSpaceModel
impl StateSpaceModel
Sourcepub fn new(
a: Vec<f64>,
b: Vec<f64>,
c: Vec<f64>,
d: Vec<f64>,
n: usize,
m: usize,
p: usize,
) -> Self
pub fn new( a: Vec<f64>, b: Vec<f64>, c: Vec<f64>, d: Vec<f64>, n: usize, m: usize, p: usize, ) -> Self
Sourcepub fn step(&mut self, u: &[f64]) -> Vec<f64>
pub fn step(&mut self, u: &[f64]) -> Vec<f64>
Step the system: apply input u (length m), advance state, return output y (length p).
Sourcepub fn step_response(&mut self, steps: usize) -> Vec<(f64, f64)>
pub fn step_response(&mut self, steps: usize) -> Vec<(f64, f64)>
Compute step response: apply unit step input 0→1, collect outputs for steps steps.
Returns a vector of (time, y[0]) pairs.
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 · 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.