void MatchedZTransform(TVec z, TVec p, Double FS)
Transform the zeros and poles of a filter in s-domain to z-domain.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | z | TVec | source TVec |
| 2 | p | TVec | source TVec |
| 3 | FS | Double | scalar |
Result: stored in self (calling object)
Remarks:
Transform the zeros Z and poles P of a filter from s-domain to z-domain, where FS is the sampling frequency. The transformation is defined as ([1], p. 224): s + a -> 1 - z^(-1)e^(-a/FS)
FS - sampling frequency a - pole or zero
If the analog system has zeros with center frequencies greater then half the sampling frequency, their z-plane positions will be greatly aliased [1]. The transformation has the advantage of not affecting the phase response of the original transfer function.
References:
[1] Theory and application of digital signal processing, Lawrence R. Rabiner and Bernard Gold. Prentice-Hall, 1975
Examples
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);
Vector Response = new Vector(0);
Vector FreqFr = new Vector(0);
double k,Wc,BW;
double FS = 2;
int Order = 5; //design a fifth order filter.
IIRFilters.BesselAnalog(Order,z,p,out k); //design analog protype
Wc = 0.5;
LinearSystems.LowpassToLowpass(z,p,ref k,Wc); //frequency transformation in s-domain
LinearSystems.MatchedZTransform(z, p, FS);
k = k/LinearSystems.ComputeGain(z,p,1);
z.Size(p.Length,false);
z.SetVal(-1); //add missing zeros at -1
LinearSystems.ZeroPoleToTransferFun(num,den,z,p,k);
SignalUtils.FrequencyResponse(num,den,Response,64,false,TSignalWindowType.wtRectangular,0); //zero padding set to 64
MtxVecTee.DrawIt(20*MtxExpr.Log10(MtxExpr.Abs(Response)),"Magnitude",false);
MtxVecTee.DrawIt(MtxExpr.PhaseSpectrum(Response)*(180/Math.PI),"Phase",false);
}
See Also: LinearSystems.Bilinear