DewDSPMasterNET
RationalSubstitution Routines
Summary
Replace the variable of a rational polynomial with another rational polyniomial.

Unit
LinearSystems

Declaration
Procedure RationalSubstitution(num, den: TVec; Nz, Dz: TVec);

Description
Num is the nominator and den is the denominator of the original polynomial. Nz is the nominator and Dz is the denominator of the polynom to substitude the variable with in the original polynomial. The function returns modified num and den. Num and den must have the same length. Nz and Dz must have the same length. The advantage of this method is that rooting of the polynomials is not required. The resulting polynomial is normalized to have the coefficient for the highest power in the polynomial equal to 1.
Declaration
Procedure RationalSubstitution(z, p: TVec; var k: TSample; Nz, Dz: TVec);

Description
Zeroes of the original polynomial are stored in z and poles in p vector. Nz is the nominator and Dz is the denominator of the polynom to substitude the variable with in the original polynomial. The function returns modified z and p. Nz and Dz must have the same length. k is the gain factor (not modified).
Categories
IIR filter design routines

Example 1

Substitute the variable:
z^2 - 2*z + 1 z - 1 ------------------ , z -- > ----- z^2- 4*z + 1 z - 2 The resulting polynomial: -0.5 ------------------ z^2 - 3*z + 1.5
The code: uses MtxExpr, Math387, MtxVec, MtxVecTee, MtxVecEdit, LinearSystems, IirFilters, SignalUtils; procedure TForm.Button1Click(Sender: TObject); var num,den,den1,num1: Vector; begin num.SetIt(false,[1,-2, 1]); den.SetIt(false,[1,-4, 1]); num1.SetIt(false,[1,-1]); den1.SetIt(false,[1,-2]); RationalSubstitution(num,den,num1,den1); ViewValues(num,'Num',true); ViewValues(den,'Den',true); // num = [ 0, 0, -0.5] // den = [ 1,-3, 1.5] end;
#include "MtxVecCPP.h" //MtxVecCPP.cpp must be included in the project #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" #include "IirFilters.hpp" #include "LinearSystems.hpp" void __fastcall TForm1::BitBtn1Click(TObject *Sender) { Vector num,den,den1,num1; num->SetIt(false,OPENARRAY(double,(1,-2, 1))); den->SetIt(false,OPENARRAY(double,(1,-4, 1))); num1->SetIt(false,OPENARRAY(double,(1,-1))); den1->SetIt(false,OPENARRAY(double,(1,-2))); RationalSubstitution(num,den,num1,den1); ViewValues(num,"Num",true); ViewValues(den,"Den",true); // num = [ 0, 0, -0.5] // den = [ 1,-3, 1.5] }
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 num = new Vector(0); Vector den = new Vector(0); Vector den1 = new Vector(0); Vector num1 = new Vector(0); num.SetIt(false,new double[3] {1,-2, 1}); den.SetIt(false,new double[3] {1,-4, 1}); num1.SetIt(false,new double[2] {1,-1}); den1.SetIt(false,new double[2] {1,-2}); LinearSystems.RationalSubstitution(num,den,num1,den1); MtxVecEdit.ViewValues(num,"Num",true); MtxVecEdit.ViewValues(den,"Den",true); // num = [ 0, 0, -0.5] // den = [ 1,-3, 1.5] }

Copyright 2008 Dew Research
http://www.dewresearch.com