zp = ZerosAndPoles'constructor'.fromPolesAndZeros(z, p, k) or zp = ZerosAndPoles'constructor'.fromPolesAndZeros(z, p, k, uName, yName)
This function constructs a ZerosAndPoles transfer function from denominator and numerator zeros, as well as a gain.
Since only transfer functions with real coefficients are supported, complex roots must be defined as conjugate complex pairs. It is required that complex conjugate pairs must directly follow each other as above. An error occurs if this is not the case.
(s+1) zp = 4 * ------------------------------------- (s - 1)*(s - (2+j*3))*(s - (2-j*3))
with j=sqrt(-1), is defined as
import Complex; import Modelica_LinearSystems2.ZerosAndPoles; zp = ZerosAndPoles(z = {Complex(-1,0)}, p = {Complex(1,0), Complex(2,3), Complex(2,-3)}, k=4);
encapsulated function fromZerosAndPoles import Modelica; import Modelica_LinearSystems2; import Modelica_LinearSystems2.ZerosAndPoles; import Modelica_LinearSystems2.Internal; import Complex; input Complex z[:] = fill(Complex(0, 0), 0) "Zeros (Complex vector of numerator zeros)"; input Complex p[:] = fill(Complex(0, 0), 0) "Poles (Complex vector of denominator zeros)"; input Real k = 1.0 "Constant multiplied with transfer function"; input String uName = "" "Input name"; input String yName = "" "Output name"; output ZerosAndPoles zp(redeclare Real n1[Internal.numberOfRealZeros(z)], redeclare Real n2[integer((size(z, 1) - Internal.numberOfRealZeros(z))/2), 2], redeclare Real d1[Internal.numberOfRealZeros(p)], redeclare Real d2[integer((size(p, 1) - Internal.numberOfRealZeros(p))/2), 2]) "ZerosAndPoles transfer functions of the zeros, poles and k"; end fromZerosAndPoles;