harold.discretize

harold.discretize(G, dt, method='tustin', prewarp_at=0.0, q=None)

Continuous- to discrete-time model conversion.

The default discretization method is ‘tustin’.

Parameters:
  • G (State, Transfer) – The to-be-discretized system representation
  • dt (float) – The positive scalar for the sampling period in seconds
  • method (str) – The method to be used for discretization. The valid method inputs can be listed via harold._global_constants._KnownDiscretizationMethods variable.
  • prewarp_at (float) – If the discretization method is ‘tustin’ or one of its aliases, this positive scalar modifies the response such that the frequency warp happens elsewhere to match the dynamics at this frequency.
  • q (2D ndarray) –

    If given, represents the custom discretization matrix such that the following star-product is computed:

       ┌───────┐      ─┐
       │  1    │       │
    ┌──┤ ─── I │<─┐    │
    │  │  z    │  │    │
    │  └───────┘  │    │    1
    │             │    ├─  ─── I
    │   ┌─────┐   │    │    s
    └──>│     ├───┘    │
        │  Q  │        │
    ┌──>│     ├───┐    │
    │   └─────┘   │   ─┘
    │             │
    │   ┌─────┐   │
    └───┤     │<──┘
        │  G  │
    <───┤     │<──
        └─────┘
    

    where Q is the kronecker product, I_n ⊗ q and n being the number of states.

Returns:

Gd (State, Transfer) – The resulting discrete model representation

Notes

Apart from the zero-order hold, first-order hold methods, the remaining methods are special cases of a particular Q and computed as as such.