Skip to main content

ZerosPolesGain

Struct ZerosPolesGain 

Source
#[non_exhaustive]
pub struct ZerosPolesGain { pub zeros: Vec<Complex<f64>>, pub poles: Vec<Complex<f64>>, pub gain: f64, pub dt: Option<f64>, }
Expand description

A single-input, single-output system H = k ∏(x − zᵢ) / ∏(x − pⱼ) with x = s in continuous time (dt = None) or x = z in discrete time with sample time dt (SciPy’s ZerosPolesGain and lti(z, p, k) / dlti(z, p, k, dt=dt)). Complex zeros and poles must come in conjugate pairs for the real-coefficient conversions.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§zeros: Vec<Complex<f64>>§poles: Vec<Complex<f64>>§gain: f64§dt: Option<f64>

The sample time of a discrete-time system; None in continuous time.

Implementations§

Source§

impl ZerosPolesGain

Source

pub fn new( zeros: Vec<Complex<f64>>, poles: Vec<Complex<f64>>, gain: f64, ) -> Self

A continuous-time system.

Source

pub fn new_discrete( zeros: Vec<Complex<f64>>, poles: Vec<Complex<f64>>, gain: f64, dt: f64, ) -> Result<Self, ErrorsJSL>

A discrete-time system with sample time dt > 0.

Source

pub fn from_tf( num: &[f64], den: &[f64], dt: Option<f64>, ) -> Result<Self, ErrorsJSL>

From a transfer function num/den (highest power first), through tf2zpk.

Source

pub fn from_ss( sys: &ContinuousStateSpace, dt: Option<f64>, ) -> Result<Self, ErrorsJSL>

From a single-input, single-output state-space model.

Source

pub fn to_tf(&self) -> (Vec<f64>, Vec<f64>)

The transfer function (num, den), highest power first (SciPy’s to_tf).

Source

pub fn to_ss(&self) -> Result<ContinuousStateSpace, ErrorsJSL>

A state-space realisation in controllable canonical form (SciPy’s to_ss). For a discrete-time system the matrices are those of x[k+1] = A x[k] + B u[k].

Source

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

The frequency response at the angular frequencies w: H(iω) in continuous time (rad/s), H(e^{iω}) in discrete time (rad/sample, as SciPy’s dfreqresp), evaluated factor by factor.

Source

pub fn bode(&self, w: &[f64]) -> (Vec<f64>, Vec<f64>)

The Bode diagram: 20 log₁₀|H| in dB and the unwrapped phase in degrees (SciPy’s bode and dbode; in discrete time w is in rad/sample).

Source

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

The response to the input samples u at equally spaced times t from rest, with the input held or interpolated between samples (SciPy’s lsim). Continuous time only.

Source

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

The step response at times t (SciPy’s step). Continuous time only.

Source

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

The impulse response at times t (SciPy’s impulse). Continuous time only.

Source

pub fn dlsim(&self, u: &[f64]) -> Result<Vec<f64>, ErrorsJSL>

The response to the samples u from rest (SciPy’s dlsim). Discrete time only.

Source

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

The first n samples of the step response (SciPy’s dstep). Discrete time only.

Source

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

The first n samples of the response to a unit pulse at k = 0 (SciPy’s dimpulse). Discrete time only.

Source

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

The discrete-time system for sample time dt (SciPy’s to_discrete, i.e. cont2discrete on the state-space form and back).

Trait Implementations§

Source§

impl Clone for ZerosPolesGain

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 ZerosPolesGain

Source§

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

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

impl PartialEq for ZerosPolesGain

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 ZerosPolesGain

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.