(z,p,k) = TransferFunction.Analysis.zerosAndPoles(tf)
This function calculates the zeros, poles and gain of transfer function. Analysis.evaluate is used to calculate gain k.
TransferFunction s = Modelica_LinearSystems2.TransferFunction.s(); Modelica_LinearSystems2.TransferFunction tf=(s+1)/(s^2+s+1); public output Complex z; output Complex p; output Real k; algorithm (z,p,k)=Modelica_LinearSystems2.TransferFunction.Analysis.zerosAndPoles(tf); // z = {-1} // p = {-0.5 + 0.866025*j, -0.5 - 0.866025*j} // k = 1
encapsulated function zerosAndPoles import Complex; import Modelica_LinearSystems2.Math.Polynomial; import Modelica_LinearSystems2.TransferFunction; input TransferFunction tf "transfer function of a system"; output Complex z[:] = Polynomial.roots(Polynomial(tf.n)) "Zeros (Complex vector of numerator zeros)"; output Complex p[:] = Polynomial.roots(Polynomial(tf.d)) "Poles (Complex vector of denominator zeros)"; output Real k "Constant multiplied with transfer function that is factorized with zeros and poles"; end zerosAndPoles;