You are here: Symbol Reference > LinearSystems Namespace > Functions > LinearSystems.RationalSubstitution Function
DSP Master VCL
ContentsIndex
Example

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 "MtxExpr.hpp" //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)
    {
        sVector 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]
    }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.