Skip to main content

ContinuousStateSpace

Struct ContinuousStateSpace 

Source
pub struct ContinuousStateSpace {
    pub a: Array2<f64>,
    pub b: Array2<f64>,
    pub c: Array2<f64>,
    pub d: Array2<f64>,
}
Expand description

A continuous-time state-space model with real matrices (SciPy’s StateSpace with dt=None).

Fields§

§a: Array2<f64>§b: Array2<f64>§c: Array2<f64>§d: Array2<f64>

Implementations§

Source§

impl ContinuousStateSpace

Source

pub fn new( a: Array2<f64>, b: Array2<f64>, c: Array2<f64>, d: Array2<f64>, ) -> Result<Self, ErrorsJSL>

A model from its matrices, checking that the shapes agree.

Source

pub fn poles(&self) -> Result<Vec<Complex<f64>>, ErrorsJSL>

The poles, the eigenvalues of A.

Source

pub fn lsim( &self, u: &Array2<f64>, t: &[f64], x0: Option<&[f64]>, hold: InputHold, ) -> Result<Simulation, ErrorsJSL>

Simulates the response to the input samples u (one row per time) at equally spaced times t, from the initial state x0 (zero if None) (SciPy’s lsim).

The input is held constant (InputHold::Zero) or interpolated linearly (InputHold::Linear) between samples, and each step is then exact: with M = [[A T, B T, 0], [0, 0, I], [0, 0, 0]] and e^M’s top blocks Φ, Γ₁, Γ₂, x[i+1] = Φ x[i] + (Γ₁ − Γ₂) u[i] + Γ₂ u[i+1].

Source

pub fn step(&self, t: &[f64], input: usize) -> Result<Array2<f64>, ErrorsJSL>

The step response from input input at times t (SciPy’s step, with a zero-order hold).

Source

pub fn impulse(&self, t: &[f64], input: usize) -> Result<Array2<f64>, ErrorsJSL>

The impulse response C e^{At} B from input input at times t (SciPy’s impulse, which leaves out the D δ(t) term).

Source

pub fn freqresp( &self, w: &[f64], ) -> Result<Vec<Array2<Complex<f64>>>, ErrorsJSL>

The frequency response H(iω) = C (iω I − A)⁻¹ B + D at each angular frequency, one p × m matrix per frequency.

Source

pub fn bode( &self, w: &[f64], input: usize, output: usize, ) -> Result<(Vec<f64>, Vec<f64>), ErrorsJSL>

The Bode diagram from input input to output output (SciPy’s bode): the magnitude 20 log₁₀ |H(iω)| in dB and the unwrapped phase in degrees.

Source

pub fn discretize( &self, dt: f64, method: Discretization, ) -> Result<DiscreteMatrices, ErrorsJSL>

The discrete-time system for sample time dt (SciPy’s cont2discrete).

Source§

impl ContinuousStateSpace

Source

pub fn default_response_times(&self, n: usize) -> Result<Vec<f64>, ErrorsJSL>

The time grid SciPy’s step and impulse use when none is given: n points from 0 to 7/r, where r is the smallest |Re λ| over the eigenvalues of A (7 time constants of the slowest mode; r = 1 if some mode is undamped).

Trait Implementations§

Source§

impl Clone for ContinuousStateSpace

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContinuousStateSpace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ContinuousStateSpace

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ContinuousStateSpace

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.