The following example computes the coefficients of the rational polynomial. The numerator has zeros at 3 and 4 and the denominator has zeros at 1 and 2. The polynomial in zero pole form can be written as:
(x - 3)*(x - 4) --------------- (y - 2)*(y - 1)
And in transfer function form:
x^2 - 7*x + 12 -------------- x^2 - 3*x + 2
Notice that powers are falling from left to right.
uses MtxExpr, Math387, MtxVec, MtxVecTee, MtxVecEdit, LinearSystems; procedure TForm1.Button1Click(Sender: TObject); var z,p,num,den: Vector; k: Double; begin z.SetIt(false,[3,4]); p.SetIt(false,[1,2]); k := 1; ZeroPoleToTransferFun(num,den,z,p,k); ViewValues(num); ViewValues(den); // num = [1, -7, 12] // den = [1, -3, 2] end;
#include "MtxExpr.hpp" #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" #include "LinearSystems.hpp" void __fastcall TForm41::BitBtn1Click(TObject *Sender) { sVector z,p,num,den; double k; z.Size(2); z[0] = 3; z[1] = 4; p.Size(2); p[0] = 1; p[1] = 2; k = 1; ZeroPoleToTransferFun(num,den,z,p,k); ViewValues(num); ViewValues(den); // num = [1, -7, 12] // den = [1, -3, 2] }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|