Engee documentation

zp2ss

Transformation of the zero- and pole-gain filter parameters into the form of a state space.

Library

EngeeDSP

Syntax

Function call

  • A,B,C,D = zp2ss(z,p,k) — finds a representation in the state space



    thus, it is equivalent to a system in the form of a factorized transfer function.

    Column vector p defines the position of the poles, and the matrix z — the position of the zeros, with the number of columns equal to the number of outputs. The gain coefficients for each transfer function of the numerator are in the vector k. Matrices A, B, C and D they are returned in the canonical form of the controller.

Arguments

Input arguments

# z — zeros

+ vector

Details

The zeros of the system, specified as a vector. The zeros must be real or represent complex conjugate pairs.

Values Inf can be used as placeholders in z if there are fewer zeros in some columns than in others.

Типы данных

Float64

Support for complex numbers

Yes

# p — poles

+ vector

Details

The poles of the system, defined as a vector. The poles must be real or represent complex conjugate pairs.

Типы данных

Float64

Support for complex numbers

Yes

# k — linear gain

+ scalar

Details

The linear gain of the system, set as a scalar.

Типы данных

Float64

Output arguments

# A is a matrix of states

+ the matrix

Details

The matrix of states returned as a matrix. If the system is described state variables, then A has the dimension on .

Типы данных

Float32, Float64

# B is a matrix for converting input data into states

+ the matrix

Details

A matrix for converting input data into states, returned as a matrix. If the system is described state variables, then B has the dimension on .

Типы данных

Float32, Float64

# C is a matrix for converting states to output data

+ the matrix

Details

The matrix of transformation of states into output data, returned as a matrix. If the system has outputs and is described state variables, then C has the dimension on .

Типы данных

Float32, Float64

# D is a matrix of input signals

+ the matrix

Details

The matrix of input signals returned as a matrix. If the system has outputs, then D has the dimension on .

Типы данных

Float32, Float64

Examples

Representation of the mass-spring system in the state space

Details

Let’s create a representation of the mass-spring system with damping in the state space, which obeys the differential equation:

The measured value is acceleration , and — the driving force. In Laplace space, the system is represented as follows:

The system has a single gain factor, double zero at and two complex conjugate poles.

z = [0, 0]
p = roots([1, 0.01, 1])
p = reshape(p, :)
2-element Vector{ComplexF64}:
 -0.0050000000000000044 + 0.999987499921874im
  -0.004999999999999977 - 0.999987499921874im
k = 1

Using the function zp2ss to find the matrices of the state space.

import EngeeDSP.Functions: zp2ss

A,B,C,D = zp2ss(z,p,k)
println("A = ", A, "\nB = ", B, "\nC = ", C, "\nD = ", D)
A = [-0.010000000000000009 -1.0; 0.9999999999999998 0.0]
B = [1.0; 0.0;;]
C = [-0.010000000000000009 -1.0]
D = [1.0;;]

Algorithms

Function zp2ss for systems with one input, it groups complex pairs into two-by-two blocks along the diagonal of the matrix. A. To do this, the zeros and poles must be real or complex conjugate pairs.