Convert transfer function from numerator-denominator to zero-pole form.
Convert a transfer function defined with numerator Num and denominator Den in to its zero-pole form with zeros Z, poles P and gain K. The routine calls PolyRoots routine from the Polynoms unit. Numerator and denominator can be real or complex.
Example 1
A rational polynomial can be converted to zero pole form by finding the roots of the numerator and denominator:
x^2 - 7*x + 12
--------------
x^2 - 3*x + 2
Zero pole form:
(x - 3)*(x - 4)
---------------
(y - 2)*(y - 1)
uses MtxExpr, Math387, MtxVec, MtxVecTee, MtxVecEdit,
LinearSystems;
procedure TForm1.Button1Click(Sender: TObject);
var z,p,num,den: Vector;
k: TSample;
begin
num.SetIt(false,[1,-7,12]);
den.SetIt(false,[1,-3, 2]);
TransferFunToZeroPole(z,p,k,num,den);
ViewValues(z);
ViewValues(p);
// z = [4 , 3]
// p = [2 , 1]
// k = num[0]/den[0] = 1;
end;
#include "MtxVecCPP.h" //MtxVecCPP.cpp must be included in the project
#include "MtxVecEdit.hpp"
#include "MtxVecTee.hpp"
#include "LinearSystems.hpp"
void __fastcall TForm41::BitBtn1Click(TObject *Sender)
{
Vector z,p,num,den;
double k;
num->Size(3);
num[0] = 1;
num[1] = -7;
num[2] = 12;
den->Size(3);
den[0] = 1;
den[1] =-3;
den[2] = 2;
TransferFunToZeroPole(z,p,k,num,den);
ViewValues(z);
ViewValues(p);
// num = [1, -7, 12]
// den = [1, -3, 2]
}
using Dew.Math;
using Dew.Math.Editors;
using Dew.Math.Units;
using Dew.Signal;
using Dew.Signal.Units;
using Dew.Math.Tee;
using Dew.Signal.Tee;
private void button1_Click(object sender, EventArgs e)
{
Vector z = new Vector(0);
Vector p = new Vector(0);
Vector num = new Vector(3);
Vector den = new Vector(3);
double k;
num.Values[0] = 1;
num.Values[1] = -7;
num.Values[2] = 12;
den.Values[0] = 1;
den.Values[1] = -3;
den.Values[2] = 2;
k = 1;
LinearSystems.TransferFunToZeroPole(z, p, out k, num, den);
MtxVecEdit.ViewValues(z,"Zeros",true);
MtxVecEdit.ViewValues(p,"Poles",true);
// z = [4 , 3]
// p = [2 , 1]
// k = num[0]/den[0] = 1;
}