[][src]Type Definition automatica::transfer_function::discrete::Tfz

type Tfz<T> = TfGen<T, Discrete>;

Discrete transfer function

Implementations

impl<T: Float> Tfz<T>[src]

pub fn delay(k: i32) -> impl Fn(Complex<T>) -> Complex<T>[src]

Time delay for discrete time transfer function. y(k) = u(k - h) `G(z) = z^(-h)

Arguments

  • h - Time delay

Example

use num_complex::Complex;
use automatica::{units::Seconds, Tfz};
let d = Tfz::delay(2);
assert_eq!(0.010000001, d(Complex::new(0., 10.0_f32)).norm());

#[must_use]pub fn init_value(&self) -> T[src]

System inital value response to step input. y(0) = G(z->infinity)

Example

use automatica::{poly, Tfz};
let tf = Tfz::new(poly!(4.), poly!(1., 5.));
assert_eq!(0., tf.init_value());

impl<'a, T: 'a + Add<&'a T, Output = T> + Div<Output = T> + Zero> Tfz<T>[src]

#[must_use]pub fn static_gain(&'a self) -> T[src]

Static gain G(1). Ratio between constant output and constant input. Static gain is defined only for transfer functions of 0 type.

Example

use automatica::{poly, Tfz};
let tf = Tfz::new(poly!(5., -3.),poly!(2., 5., -6.));
assert_eq!(2., tf.static_gain());

impl<T: ComplexField + Float + RealField> Tfz<T>[src]

#[must_use]pub fn is_stable(&self) -> bool[src]

System stability. Checks if all poles are inside the unit circle.

Example

use automatica::{Poly, Tfz};
let tfz = Tfz::new(Poly::new_from_coeffs(&[1.]), Poly::new_from_roots(&[0.5, 1.5]));
assert!(!tfz.is_stable());

impl<T: Float + Mul<Output = T> + Sum> Tfz<T>[src]

pub fn arma_fn<F>(&self, input: F) -> ArmaFn<F, T>

Notable traits for ArmaFn<F, T>

impl<F, T> Iterator for ArmaFn<F, T> where
    F: Fn(usize) -> T,
    T: Float + Mul<Output = T> + Sum
type Item = T;
where
    F: Fn(usize) -> T, 
[src]

Autoregressive moving average representation of a discrete transfer function It transforms the transfer function into time domain input-output difference equation.

                  b_n*z^n + b_(n-1)*z^(n-1) + ... + b_1*z + b_0
Y(z) = G(z)U(z) = --------------------------------------------- U(z)
                    z^n + a_(n-1)*z^(n-1) + ... + a_1*z + a_0

y(k) = - a_(n-1)*y(k-1) - ... - a_1*y(k-n+1) - a_0*y(k-n) +
       + b_n*u(k) + b_(n-1)*u(k-1) + ... + b_1*u(k-n+1) + b_0*u(k-n)

Arguments

  • input - Input function

Example

use automatica::{poly, signals::discrete, Tfz};
let tfz = Tfz::new(poly!(1., 2., 3.), poly!(0., 0., 0., 1.));
let mut iter = tfz.arma_fn(discrete::step(1., 0));
assert_eq!(Some(0.), iter.next());
assert_eq!(Some(3.), iter.next());
assert_eq!(Some(5.), iter.next());
assert_eq!(Some(6.), iter.next());

pub fn arma_iter<I, II>(&self, iter: II) -> ArmaIter<I, T>

Notable traits for ArmaIter<I, T>

impl<I, T> Iterator for ArmaIter<I, T> where
    I: Iterator<Item = T>,
    T: Float + Mul<Output = T> + Sum
type Item = T;
where
    II: IntoIterator<Item = T, IntoIter = I>,
    I: Iterator<Item = T>, 
[src]

Autoregressive moving average representation of a discrete transfer function It transforms the transfer function into time domain input-output difference equation.

                  b_n*z^n + b_(n-1)*z^(n-1) + ... + b_1*z + b_0
Y(z) = G(z)U(z) = --------------------------------------------- U(z)
                    z^n + a_(n-1)*z^(n-1) + ... + a_1*z + a_0

y(k) = - a_(n-1)*y(k-1) - ... - a_1*y(k-n+1) - a_0*y(k-n) +
       + b_n*u(k) + b_(n-1)*u(k-1) + ... + b_1*u(k-n+1) + b_0*u(k-n)

Arguments

  • iter - Iterator supplying the input data to the model

Example

use automatica::{poly, signals::discrete, Tfz};
let tfz = Tfz::new(poly!(1., 2., 3.), poly!(0., 0., 0., 1.));
let mut iter = tfz.arma_iter(std::iter::repeat(1.));
assert_eq!(Some(0.), iter.next());
assert_eq!(Some(3.), iter.next());
assert_eq!(Some(5.), iter.next());
assert_eq!(Some(6.), iter.next());