12th order elliptic to 4th order elliptic
(I'm not eligible to the bounty.) I tried to produce a counterexample to question 3 in Octave but was pleasantly surprised that I couldn't. If the answer to the question 3 is yes, then according to Fig 5. of the question, specific poles and zeros should be shared between an elliptic filter of order 4 and an elliptic filter of order 12, here shown explicitly:
Figure 1. Poles and zeros potentially shared between elliptic filters of order N=12 and N=4, in blue and numbered in order of ascending parameter α of a parametric curve f(α).
Let's design an order 12 elliptic filter with some arbitrary parameters: 1 dB pass band ripple, -90 dB stop band ripple, cutoff frequency 0.1234, s-plane rather than z-plane:
pkg load signal;
[b12, a12] = ellip (12, 0.1, 90, 0.1234, "s");
ra12 = roots(a12);
rb12 = roots(b12);
freqs(b12, a12, [0:10000]/10000);
Figure 2. The magnitude frequency response of the 12th order elliptic filter designed using ellip
.
scatter(vertcat(real(ra12), real(rb12)), vertcat(imag(ra12), imag(rb12)));
Figure 3. Poles (red) and zeros (blue) of order 12 elliptic filter designed using ellip
. Horizontal axis: real part, vertical axis: imaginary part.
Let's construct an order 4 filter by reusing select poles and zeros of the order 12 filter, per Fig. 1. In the particular case, ordering the poles and zeros by the imaginary part is sufficient:
[~, ira12] = sort(imag(ra12));
[~, irb12] = sort(imag(rb12));
ra4 = [ra12(ira12)(2), ra12(ira12)(5), ra12(ira12)(8), ra12(ira12)(11)];
rb4 = [rb12(irb12)(2), rb12(irb12)(5), rb12(irb12)(8), rb12(irb12)(11)];
freqs(poly(rb4), poly(ra4), [0:10000]/10000);
Figure 4. Magnitude frequency response of the 4th order filter that has all poles and zeros identical to certain ones of those of the 12th order filter, per Fig. 1. Zooming in gives a characterization of the filter: 3.14 dB pass band equiripple, -27.69 dB stop band equiripple, cutoff frequency 0.1234.
It is my understanding that an equiripple pass band and an equiripple stop band with as many ripples as the number of poles and zeros allows is a sufficient condition to say that the filter is elliptic. But let's try if this is confirmed by designing an order 4 elliptic filter by ellip
with the characterization obtained from Fig 3 and by comparing the poles and zeros between the two order 4 filters:
[b4el, a4el] = ellip (4, 3.14, 27.69, 0.1234, "s");
rb4el = roots(b4el);
ra4el = roots(a4el);
scatter(vertcat(real(ra4), real(rb4)), vertcat(imag(ra4), imag(rb4)));
That against:
scatter(vertcat(real(ra4el), real(rb4el)), vertcat(imag(ra4el), imag(rb4el)), "blue", "x");
Figure 5. Comparison of pole (red) and zero (blue) locations between an ellip
-designed 4th order filter (crosses) and a 4th order filter (circles) that shares certain pole and zero locations with the 12th order filter. Horizontal axis: real part, vertical axis: imaginary part.
The poles and zeros coincide between the two filters to three decimal places, which was the precision of the characterization of the filter derived from the order 12 filter. The conclusion is that at least in this particular case both the poles and zeros of the order 4 elliptic filter and those of the order 12 elliptic filter could have been obtained, at least up to a precision, by uniformly distributing them on the same parametric curves. The filters were not Butterworth or Chebyshev I or II type filters as both the pass band and the stop band had ripples.
4th order elliptic to 12th order elliptic
Conversely, can the poles and zeros of the 12th order filter be approximated from a pair of continuous functions fitted to the poles and zeros of the 4th order ellip
filter?
If we duplicate the four poles (Fig. 5) and flip the sign of the real parts of the duplicates, we get an oval of sorts. As we go round and round the oval, the pole locations that we pass give a periodic discrete sequence. It is a good candidate for periodic band-limited interpolation by zero-padding its discrete Fourier transform (DFT). Of the resulting 24 poles the ones with a positive real part are discarded, halving the number of poles to 12. Instead of the zeros, their reciprocals are interpolated, but otherwise the interpolation is done the same way as with the poles. We start with the same ellip
-designed 4th order filter as earlier (approximately identical to Fig. 4):
pkg load signal;
[b4el, a4el] = ellip (4, 3.14, 27.69, 0.1234, "s");
rb4el = roots(b4el);
ra4el = roots(a4el);
rb4eli = 1./rb4el;
[~, ira4el] = sort(imag(ra4el));
[~, irb4eli] = sort(imag(rb4eli));
ra4eld = vertcat(ra4el(ira4el), -ra4el(ira4el));
rb4elid = vertcat(rb4eli(irb4eli), -rb4eli(irb4eli));
ra12syn = -interpft(ra4eld, 24)(12:23);
rb12syn = -1./interpft(rb4elid, 24)(12:23);
freqs(poly(rb12syn), poly(ra12syn), [0:10000]/10000);
Figure 6. Magnitude frequency response of a 12th order filter with the poles and zeros sampled from curves matched to those of the 4th order filter.
It is not an accurate enough of a mockup of the Fig. 2 response to be useful. The stop band fares pretty well but the pass band is tilted. The band edge frequencies are approximately correct. Still, this shows potential considering the parametric curves were only described by 4 degrees of freedom each.
Let's have a look at how the poles and zeros match those of the N=12 ellip
-generated filter:
[b12, a12] = ellip (12, 0.1, 90, 0.1234, "s");
ra12 = roots(a12);
rb12 = roots(b12);
scatter(vertcat(real(ra12), real(rb12)), vertcat(imag(ra12), imag(rb12)), "blue", "x");
scatter(vertcat(real(ra12syn), real(rb12syn)), vertcat(imag(ra12syn), imag(rb12syn)));
Figure 7. Comparison of pole (red) and zero (blue) locations between an ellip
-designed 12th order filter (crosses) and a 12th order filter (circles) that was derived from the 4th order filter. Horizontal axis: real part, vertical axis: imaginary part.
The interpolated poles are quite a bit off, but zeros are matched relatively well. A larger N as the starting point should be investigated.
6th order elliptic to 18th order elliptic
Doing the same as above but starting at 6th order and interpolating to 18th order shows a seemingly well-behaved magnitude frequency response, but still has trouble in the pass band when examined closely:
[b6el, a6el] = ellip (6, 0.03, 30, 0.1234, "s");
rb6el = roots(b6el);
ra6el = roots(a6el);
rb6eli = 1./rb6el;
[~, ira6el] = sort(imag(ra6el));
[~, irb6eli] = sort(imag(rb6eli));
ra6eld = vertcat(ra6el(ira6el), -ra6el(ira6el));
rb6elid = vertcat(rb6eli(irb6eli), -rb6eli(irb6eli));
ra18syn = -interpft(ra6eld, 36)(18:35);
rb18syn = -1./interpft(rb6elid, 36)(18:35);
freqs(poly(rb18syn), poly(ra18syn), [0:10000]/10000);
Figure 8. Top) 6th order ellip
-generated filter, Bottom) 18th order filter derived from the 6th order filter. Zoomed in, the pass band has only two maxima and about 1 dB of ripple. The stop band is nearly equiripple with 2.5 dB of variation.
My guess about the trouble at the pass band is that the band-limited interpolation isn't working well enough with the (real parts of the) poles.
Exact curves for elliptic filters
It turns out that elliptic filters for which NNz=NNp=N provide positive examples to questions 1 and 2. C. Sidney Burrus, Digital Signal Processing and Digital Filter Design (Draft). OpenStax CNX. Nov 18, 2012 gives the zeros and poles of the transfer function of a sufficiently general NNz=NNp=N elliptic filter in terms of the Jacobi elliptic sine sn(t,k). Noting that sn(t,k)=−sn(−t,k), Burrus Eq. 3.136 can be rewritten for zeros szi, i=1…N as:
szi=jksn(K+K(2i+1)/N,k),(1)
where K is a quarter period of sn(t,k) for real t, and 0≤k≤1 can be seen as a degree of freedom in the parameterization of the filter. It controls the transition band width relative to pass band width. Recognizing (2i+1)/N=2α (see Eq. 2 of the question) where α is the parameter of the parametric curve:
fz(α)=jksn(K+2Kα,k),(2)
Burrus Eq. 3.146 gives the upper-left quarter-plane poles including a real pole for odd N. It can be rewritten for all poles spi, i=1…N with any N as:
spi=cn(K+K(2i+1)/N,k)dn(K+K(2i+1)/N,k)sn(ν0,1−k2−−−−−√)×cn(ν0,1−k2−−−−−√)+jsn(K+K(2i+1)/N,k)dn(ν0,1−k2−−−−−√)1−dn2(K+K(2i+1)/N,k)sn2(ν0,1−k2−−−−−√),(3)
where dn(t,k)=1−k2sn2(t,k)−−−−−−−−−−−−√ is one of the Jacobi elliptic functions. Some sources have k2 as the second argument for all of these functions and call it the modulus. We have k and call it the modulus. The variable 0<ν0<K´ can be thought of as one of the two degrees of freedom (k,ν0) of the sufficiently general parametric curves, and one of the three degrees of freedom (k,ν0,N) of a sufficiently general elliptic filter. At ν0=0 the pass band ripple would be infinite and at ν0=K´ where K´ is the quarter period of Jacobi elliptic functions with modulus 1−k2−−−−−√, poles would equal zeros. By sufficiently general I mean that there is just one remaining degree of freedom that controls the pass band edge frequency and which will manifest itself as uniform scaling of both parametric curve functions by the same factor. The subset of elliptic filters that share fp(α), fz(α), and an irreducible fraction Nz/Pz=1, are transformed to another subset of infinite size in dimension N upon change of the trivial degree of freedom.
By the same substitution as with the zeros, the parametric curve for the poles can be written as:
fp(α)=cn(K+2Kα,k)dn(K+2Kα,k)sn(ν0,1−k2−−−−−√)×cn(ν0,1−k2−−−−−√)+jsn(K+2Kα,k)dn(ν0,1−k2−−−−−√)1−dn2(K+2Kα,k)sn2(ν0,1−k2−−−−−√).(4)
Let's plot the functions and the curves in Octave, for values of k and ν0 (v0
in the code) copied from Burrus Example 3.4:
k = 0.769231;
v0 = 0.6059485; #Maximum is ellipke(1-k^2)
K = 1024; #Resolution of plots
[snv0, cnv0, dnv0] = ellipj(v0, 1-k^2);
dnv0=sqrt(1-(1-k^2)*snv0.^2); # Fix for Octave bug #43344
[sn, cn, dn] = ellipj([0:4*K-1]*ellipke(k^2)/K, k^2);
dn=sqrt(1-k^2*sn.^2); # Fix for Octave bug #43344
a2K = [0:4*K-1];
a2KpK = mod(K + a2K - 1, 4*K)+1;
fza = i./(k*sn(a2KpK));
fpa = (cn(a2KpK).*dn(a2KpK)*snv0*cnv0 + i*sn(a2KpK)*dnv0)./(1-dn(a2KpK).^2*snv0.^2);
plot(a2K/K/2, real(fza), a2K/K/2, imag(fza), a2K/K/2, real(fpa), a2K/K/2, imag(fpa));
ylim([-2,2]);
a = [1/6, 3/6, 5/6];
ai = round(a*2*K)+1;
scatter(vertcat(a, a), vertcat(real(fza(ai)), imag(fza(ai)))); ylim([-2,2]); xlim([0, 2]);
scatter(vertcat(a, a), vertcat(real(fpa(ai)), imag(fpa(ai))), "red", "x"); ylim([-2,2]); xlim([0, 2]);
Figure 9. fz(α) and fp(α) for Burrus Example 3.4, analytically extended to period α=0…2. The three poles (red crosses) and the three zeros (blue circles, one infinite and not shown) of the example are sampled uniformly with respect to α at α=1/6, α=3/6, and α=5/6, from these functions, per Eq. 2 of the question. With the extension, the reciprocal of Im(fz(α)) (not shown) oscillates very gently, making it easy to approximate by a truncated Fourier series as in the previous sections. The other periodic extended functions are also smooth, but not so easy to approximate that way.
plot(real(fpa)([1:2*K+1]), imag(fpa)([1:2*K+1]), real(fza)([1:2*K+1]), imag(fza)([1:2*K+1]));
xlim([-2, 2]);
ylim([-2, 2]);
scatter(real(fza(ai)), imag(fza(ai))); ylim([-2,2]); xlim([-2, 2]);
scatter(real(fpa(ai)), imag(fpa(ai)), "red", "x"); ylim([-2,2]); xlim([-2, 2]);
Figure 10. Parametric curves for Burrus Example 3.4. Horizontal axis: real part, vertical axis: imaginary part. This view does not show the speed of the parametric curve so the three poles (red crosses) and the three zeros (blue circles, one infinite and not shown) do not appear to be uniformly distributed on the curves, even as they are, with respect to the parameter α of the parametric curves.
Elliptic filter design by the exact pole and zero formulas given by Burrus is fully equivalent to sampling from the exact fp(α) and fz(α), so methods are equivalent and available. Question 1 remains open-ended. It may be that other types of filters have infinite subsets defined by fp(α) and fz(α) and Nz/Np. Of methods of approximating the elliptic parametric curves, those that do not depend on the exact functional form may be transferable to other filter types, I think most likely to those that generalize elliptic filters, such as some subset of general equiripple filters. For them, exact formulas for poles and zeros may be unknown or intractable.
Going back to Eq. 2, for odd N, we have for one of the zeros α=0.5, which sends it to infinity by sn(2K,k)=0. No such thing takes place with the poles (Eq. 4). I have updated the question to have such zeros (and poles, in case) included in the count NNz (or NNp). At k=0, all zeros go to infinity according to fz(α), which looks to give type I Chebyshev filters.
I think question 3 just got resolved and the answer is "yes". That, as it appears that we can cover all cases of elliptic filter without being in conflict with NNz=NNp, with the new definition of those.