/// <devdoc>
        /// Designs an IIR filter and returns the IIR filter coefficients. Cutoff frequencies
        /// are relative to sampling rate and must be between 0 and 0.5.
        /// Passband ripple is in dB. Must be negative. Only used for Chebyshev filter, ignored for other filters.
        /// Both low-pass and high-pass use fcf1, band-pass and band-stop need both.
        /// </devdoc>
        private IirFilterCoefficients Design(FilterKind type, int filterOrder, double ripple, double fcf1, double fcf2 = 0)
        {
            var poles = GetPoles(filterOrder, ripple);

            SToZMappingMethod sToZMappingMethod = GetSToZMappingMethod();
            var sPlane = Normalize(poles, type, fcf1, fcf2, sToZMappingMethod == SToZMappingMethod.BilinearTransform);
            var zPlane = MapSPlaneToZPlane(sPlane, sToZMappingMethod);

            var tf = ComputeTransferFunction(zPlane);
            return ComputeIirFilterCoefficients(tf, ComputeGain(tf, type, fcf1, fcf2));
        }
 /// <devdoc>
 /// Maps the poles and zeros from the s-plane (<c>sPlane)</c>to the z-plane.
 /// </devdoc>
 private static PolesAndZeros MapSPlaneToZPlane(PolesAndZeros sPlane, SToZMappingMethod sToZMappingMethod)
 {
     switch (sToZMappingMethod)
     {
         case SToZMappingMethod.BilinearTransform:
             {
                 return new PolesAndZeros
                 {
                     Poles = DoBilinearTransform(sPlane.Poles),
                     Zeros = Extend(DoBilinearTransform(sPlane.Zeros), sPlane.Poles.Length, new Complex(-1, 0))
                 };
             }
         case SToZMappingMethod.MatchedZTransform:
             {
                 return new PolesAndZeros
                 {
                     Poles = DoMatchedZTransform(sPlane.Poles),
                     Zeros = DoMatchedZTransform(sPlane.Zeros)
                 };
             }
         default:
             throw new System.ComponentModel.InvalidEnumArgumentException("sToZMappingMethod", (int)sToZMappingMethod, typeof(SToZMappingMethod));
     }
 }