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.
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(0); Vector den = new Vector(0); double k; z.SetIt(false,new double[2] {3,4}); p.SetIt(false,new double[2] {1,2}); k = 1; LinearSystems.ZeroPoleToTransferFun(num,den,z,p,k); MtxVecEdit.ViewValues(num,"Numerator",true); MtxVecEdit.ViewValues(den,"Denominator",true); // num = [1, -7, 12] // den = [1, -3, 2] }
|
Copyright (c) 1999-2010 by Dew Research. All rights reserved.
|