IIRFilters.ChebyshevIOrder Method

Int32 ChebyshevIOrder(Double[] BEdges, Double PassRipple, Double StopRipple, TFilterType FilterType, ref Double[] CutoffFreq, Boolean Analog)

Estimate the minimum Chebyshev type I filter order that meets a transition-band specification, and fill CutoffFreq with the passband-edge cutoff(s). The order is n=\lceil(cosh^(-1)sqrt((10^(R_s/10)-1)/(10^(R_p/10)-1)))/(cosh^(-1)(omega_s/omega_p))\rceil, capped at MaxIirOrder (=50), where R_p=PassRipple and R_s=StopRipple in dB. BEdges holds the band edges ascending; CutoffFreq length must be half BEdges length and match FilterType. Domain: digital edges in (0,1)(0,1) (sampling frequency 2, Analog=False) or analog rad/s (Analog=True). The returned cutoff is the passband edge.

#NameTypeDescription
1BEdgesDouble[]
2PassRippleDoublescalar
3StopRippleDoublescalar
4FilterTypeTFilterType
5CutoffFreqDouble[] (ref)
6AnalogBoolean

Returns: Int32

Remarks:

Returns the order of the Chebyshev type I filter. Bedg array must contain the band edges of the transition region(s) sorted in ascending order. PassRipple defines the ripple of the passband and StopRipple defines the ripple of the stopband. The length of the CutoffFreq array must be equal to one half of the length of the BEdg array and must match the specified FilterType. The routine returns the estimated order as a result and fill's the CutoffFreq array. This array can then be passed to the ChebyshevIFilter routine.

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;
    double[] Wc = new double[1];
    int Order; //design a fifth order filter.

    Order = IIRFilters.ChebyshevIOrder(new double[2] { 1, 4 }, 0.2,40,TFilterType.ftHighpass,ref Wc,true);  //design analog protype
    IIRFilters.ChebyshevIAnalog(Order, 0.1, z, p, out k);  //design analog protype
    LinearSystems.LowpassToHighpass(z, p, ref k, Wc[0]);
    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);
}
See Also: IIRFilters.ChebyshevIFilter