void EllipticAnalog(int Order, double PassRipple, double StopRipple, TVec *z, TVec *p, double &k);
Design an analog elliptic (Cauer) lowpass prototype filter of order Order, equiripple in BOTH bands (PassRipple dB passband, StopRipple dB stopband), cutoff fixed at 1 rad/s. Returns zero-pole-gain with finite imaginary-axis zeros: |H(jomega)|^2=1/(1+varepsilon^2 R_n^2(omega,xi)), varepsilon=sqrt(10^(R_p/10)-1), where R_n is the Chebyshev rational (elliptic) function. For a given order the elliptic design gives the narrowest transition band of the five families. At the passband edge omega=1 the magnitude equals 10^(-R_p/20). Domain: 1 <= Order <= MaxIirOrder, PassRipple>0, StopRipple>PassRipple (dB). Poles satisfy Re(p_k)<0 (stable). z and p must share precision or an exception is raised.
Design analog elliptic 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 (dB) of the passband and StopRipple defines the ripple of the stopband (dB). The cutoff frequency of the prototype filter is preset to 1 rad/sec. For pole and zero specifications see [1] p. 187.
References:
[1] Digital Filter Design, T.W.Parks and C.S.Burrs, John Wiley and Sons, 1987.
#include "MtxExpr.h"
#include "Units.Math387.h"
#include "Units.IIrFilters.h"
#include "Units.LinearSystems.h"
#include "Units.SignalUtils.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
using namespace Dew::Signal;
using namespace Dew::Signal::Units::IIRFilters;
using namespace Dew::Signal::Units::LinearSystems;
using namespace Dew::Signal::Units::SignalUtils;
void Example()
{
Vector z(0);
Vector p(0);
Vector num(0);
Vector den(0);
Vector Response(0);
Vector FreqFr(0);
double k, Wc;
int Order = 5; //design a fifth order filter.
EllipticAnalog(Order, 0.1, 20, z, p, k); //design analog protype
Wc = Sqrt(3*1); //cutoff frequency
double BW = 3 - 1;
LowpassToBandstop(z, p, k, Wc, BW);
ZeroPoleToTransferFun(num, den, z, p, k);
FreqFr.Length = 1000;
LogRamp(FreqFr, -1, 1);
FrequencyResponseS(num, den, FreqFr, Response, 0);
}