[−][src]Type Definition automatica::linear_system::discrete::Ssd
type Ssd<T> = SsGen<T, Discrete>;
State-space representation of discrete time linear system
Implementations
impl<T: ComplexField> Ssd<T>
[src]
Implementation of the methods for the state-space
pub fn equilibrium(&self, u: &[T]) -> Option<Equilibrium<T>>
[src]
Calculate the equilibrium point for discrete time systems, given the input condition. Input vector must have the same number of inputs of the system.
x = (I-A)^-1 * B * u
y = (C * (I-A)^-1 * B + D) * u
Arguments
u
- Input vector
Example
use automatica::Ssd; let a = [-1., 1., -1., 0.25]; let b = [1., 0.25]; let c = [0., 1., -1., 1.]; let d = [0., 1.]; let sys = Ssd::new_from_slice(2, 1, 2, &a, &b, &c, &d); let u = 0.0; let eq = sys.equilibrium(&[u]).unwrap(); assert_eq!((0., 0.), (eq.x()[0], eq.y()[0]));
impl<T: Scalar> Ssd<T>
[src]
Trait for the set of methods on discrete linear systems.
pub fn evolution_fn<F>(
&self,
steps: usize,
input: F,
x0: &[T]
) -> EvolutionFn<'_, F, T>ⓘNotable traits for EvolutionFn<'a, F, T>
impl<'a, F, T> Iterator for EvolutionFn<'a, F, T> where
F: Fn(usize) -> Vec<T>,
T: AddAssign + Float + MulAssign + Scalar, type Item = TimeEvolution<T>;
where
F: Fn(usize) -> Vec<T>,
[src]
&self,
steps: usize,
input: F,
x0: &[T]
) -> EvolutionFn<'_, F, T>ⓘ
Notable traits for EvolutionFn<'a, F, T>
impl<'a, F, T> Iterator for EvolutionFn<'a, F, T> where
F: Fn(usize) -> Vec<T>,
T: AddAssign + Float + MulAssign + Scalar, type Item = TimeEvolution<T>;
F: Fn(usize) -> Vec<T>,
Time evolution for a discrete linear system.
Arguments
step
- simulation lengthinput
- input functionx0
- initial state
Example
use automatica::{linear_system::discrete::DiscreteTime, Discretization, Ssd}; let disc_sys = Ssd::new_from_slice(2, 1, 1, &[0.6, 0., 0., 0.4], &[1., 5.], &[1., 3.], &[0.]); let impulse = |t| if t == 0 { vec![1.] } else { vec![0.] }; let evo = disc_sys.evolution_fn(20, impulse, &[0., 0.]); let last = evo.last().unwrap(); assert_abs_diff_eq!(0., last.state()[1], epsilon = 0.001);
pub fn evolution_iter<I, II>(
&self,
iter: II,
x0: &[T]
) -> EvolutionIter<'_, I, T>ⓘ where
II: IntoIterator<Item = Vec<T>, IntoIter = I>,
I: Iterator<Item = Vec<T>>,
[src]
&self,
iter: II,
x0: &[T]
) -> EvolutionIter<'_, I, T>ⓘ where
II: IntoIterator<Item = Vec<T>, IntoIter = I>,
I: Iterator<Item = Vec<T>>,
Time evolution for a discrete linear system.
Arguments
iter
- input datax0
- initial state
Example
use std::iter; use automatica::{linear_system::discrete::DiscreteTime, Discretization, Ssd}; let disc_sys = Ssd::new_from_slice(2, 1, 1, &[0.6, 0., 0., 0.4], &[1., 5.], &[1., 3.], &[0.]); let impulse = iter::once(vec![1.]).chain(iter::repeat(vec![0.])).take(20); let evo = disc_sys.evolution_iter(impulse, &[0., 0.]); let last = evo.last().unwrap(); assert!(last[0] < 0.001);