void ChebyshevIAnalog(Int32 Order, Double PassRipple, TVec z, TVec p, ref Double k)
Design an analog Chebyshev type I lowpass prototype filter of order Order with PassRipple dB of equiripple in the passband, cutoff fixed at 1 rad/s. Returns zero-pole-gain (z empty, all zeros at infinity): |H(jomega)|^2=1/(1+varepsilon^2 T_n^2(omega)), varepsilon=sqrt(10^(R_p/10)-1), where T_n is the order-n Chebyshev polynomial and R_p=PassRipple. The magnitude is equiripple in and monotone beyond; at the passband edge omega=1 it equals 10^(-R_p/20). Domain: 1 <= Order <= MaxIirOrder, PassRipple>0 dB. Poles satisfy Re(p_k)<0 (stable). z and p must share precision or an exception is raised.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Order | Int32 | |
| 2 | PassRipple | Double | scalar |
| 3 | z | TVec | source TVec |
| 4 | p | TVec | source TVec |
| 5 | k | Double (ref) | output |
Result: stored in self (calling object)
Design analog Chebyshev type I lowpass prototype filter of order Order. Place the resulting transfer function in zero-pole form in Z (zeros), P (poles) and K (gain). PassRipple defines the ripple of the passband (dB). The cutoff frequency of the prototype filter is preset to 1 rad/sec, the unit circle. Chebyshevs type I filters are all-pole designs and are equiripple in the passband. The filter has all zeros in infinity. The design formulas are found in [1] p. 232:
Poles: p[k] = s[k] + j*W[k] s[k] = -sinh(Phi)sin((2*k-1)*Pi/(2*n)) W[k] = cosh(Phi)*cos((2*k-1)*Pi/(2*n)) sinh(phi) = 0.5(v - 1/v) cosh(phi) = 0.5*(v + 1/v) 1 + (1 + eps^2)^0.5 v = ( --------------------- )^(1/n) eps n - order of the filter k = 1,...,n
References:
[1] "Theory and application of digital signal processing, Lawrence R. Rabiner and Bernard Gold. Prentice-Hall, 1975".
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;
int Order = 5; //design a fifth order filter.
IIRFilters.ChebyshevIAnalog(Order,0.2,z, p, out k); //design analog protype
Wc = 2; //cutoff frequency
LinearSystems.LowpassToLowpass(z, p, ref k, Wc);
LinearSystems.ZeroPoleToTransferFun(num, den, z, p, k);
FreqFr.Length = 1000;
SignalUtils.LogRamp(FreqFr, -1, 1);
SignalUtils.FrequencyResponseS(num, den, FreqFr, Response, 0);
MtxVecTee.DrawIt(Response, "Frequency response", false);
}