Overload List
| # | Signature | Description |
|---|---|---|
| 1 | void LowpassToLowpassZ(TVec Num, TVec Den, Double Freq, Double PrototypeFreq) | Apply frequency band transformation from lowpass to lowpass in the z-domain. |
| 2 | void LowpassToLowpassZ(TVec z, TVec p, ref Double k, Double Freq, Double PrototypeFreq) | The function returns modified z (zeros), p (poles) and k (gain). |
Overload 1: void LowpassToLowpassZ(TVec Num, TVec Den, Double Freq, Double PrototypeFreq)
Apply frequency band transformation from lowpass to lowpass in the z-domain.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Num | TVec | source TVec |
| 2 | Den | TVec | source TVec |
| 3 | Freq | Double | scalar |
| 4 | PrototypeFreq | Double | scalar |
Result: stored in self (calling object)
Freq is the cutoff frequency of the new filter. The function returns modified num and den. PrototypeFreq is the cutoff frequency of the prototype lowpass filter after it has been mapped to z-domain. Freq and PrototypeFreq must be between 0 and 1 (Sampling frequency = 2). The transformation is defined with the following mapping ([1] p. 260 and [2] p. 434, [3] p. 352): z^(-1) -> (z^(-1) - a)/(1 - a z^(-1)) a = (sin((wc - wn)/2))/(sin((wc + wn)/2))
wc - old cutoff frequency wn - new (desired) cutoff frequency
References:
[1] Theory and application of digital signal processing, Lawrence R. Rabiner and Bernard Gold. Prentice-Hall, 1975
[2] Discrete-time signal processing, Oppenheim and Schafer, Prentice-Hall, 1989
[3] Digital signal processing, Vinay K. Ingle and John G. Proakis, Brooks-Cole, 2000
Overload 2: void LowpassToLowpassZ(TVec z, TVec p, ref Double k, Double Freq, Double PrototypeFreq)
The function returns modified z (zeros), p (poles) and k (gain).
| # | Name | Type | Description |
|---|---|---|---|
| 1 | z | TVec | source TVec |
| 2 | p | TVec | source TVec |
| 3 | k | Double (ref) | output |
| 4 | Freq | Double | scalar |
| 5 | PrototypeFreq | Double | scalar |
Result: stored in self (calling object)
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);
double k, Wc;
double FS = 2;
int Order = 4; //design a fifth order filter.
IIRFilters.EllipticAnalog(Order,0.1,30, z, p, out k); //design analog protype
LinearSystems.Bilinear(z, p, ref k, FS,true);
Wc = 0.5;
LinearSystems.LowpassToLowpassZ(z, p, ref k, Wc, LinearSystems.BilinearUnwarp(1,FS));
LinearSystems.ZeroPoleToTransferFun(num,den, z, p, k);
SignalUtils.FrequencyResponse(num, den, Response, 64, false, TSignalWindowType.wtRectangular, 0); //zero padding set to 64
//Alternative:
// ...
// LinearSystems.ZeroPoleToTransferFun(num,den, z, p, k);
// LinearSystems.LowpassToLowpassZ(num,den, Wc, LinearSystems.BilinearUnwarp(1,FS));
MtxVecTee.DrawIt(Response, "Frequency response", false);
//MtxVecTee.DrawIt(20 * MtxExpr.Log10(MtxExpr.Abs(Response)), "Magnitude", false);
//MtxVecTee.DrawIt(MtxExpr.PhaseSpectrum(Response) * (180 / Math.PI), "Phase", false);
}