通过在参数曲线上分布极点和零点来进行滤波器设计


17

一个N巴特沃斯低通滤波器的截止频率的ωc可以通过分发被设计N相对于参数均匀磁极0<α<1上的s平面参数曲线f(α)=ωcei(π/2+πα),这是一个半圆:

巴特沃斯过滤器
图1. 6阶巴特沃兹滤波器的极点(CC BY-SA 3.0 Fcorthay)

值得注意的是,相同的参数曲线可用于任何给出非归一化传递函数的滤波器度N

(1)H(s)=k=1N1sf(2k12N),

并且所得的过滤器始终是Butterworth过滤器。也就是说,没有其他具有相同极点和零点数量的滤波器在频率ω=0,幅度频率响应的消失导数更高ω=。的一组具有相同的截止频率巴特沃斯滤波器的ωc形成巴特沃斯的一个子集来过滤该参数曲线f(α)是唯一的。子集是无限的,因为N没有上限。

更一般地,除非它们源自参数曲线,否则不对无穷大的极点和零点进行计数,任何具有NNp极点和NNz零点,N个整数和Nz/Np个整数的非负分数的滤波器都具有未归一化的传递函数形式:

(2)H(s)=k=1NNz(sfz(2k12NNz))k=1NNp(sfp(2k12NNp)),

其中fp(α)fz(α)是参数曲线,可以描述极点中极点和零点的分布N

  • 问题1:除了由最佳准则定义的Butterworth以外,还有哪些其他类型的滤波器具有无限的子集,每个子​​集分别由分数Nz/Np和每方程式的一对参数曲线fp(α)fz(α)。2,滤波器仅相差N类型I Chebyshev过滤器,是的;通过它们,极点位于参数角为的椭圆的一半上α。Butterworth和I型和II型Chebyshev滤波器都是椭圆滤波器的特例。需要明确的是,“无限子集”并不是指无限数量的子集,而是无限大小的子集。
  • 问题2:非Butterworth-非Chebyshev椭圆滤波器是否具有这样的无限子集?
  • 问题3:难道每个椭圆滤波器都是这样的无限子集吗?

如果所有椭圆滤波器的无穷集是椭圆滤波器的互斥和穷举无穷子集的并集,则每个子集由用于放置极点的单个参数曲线和用于放置零的单个参数曲线以及不可逆部分的数量定义零到极点,然后可以通过优化参数曲线而不是针对任何特定顺序的滤波器来进行数值优化以获得椭圆滤波器。最优曲线可以重复用于多个滤波器阶数,从而保持最优性。上面的“ if”是为什么我问问题2和3。问题1是关于将方法扩展到其他最优标准的。

椭圆滤波器的零极点图肯定看起来像有一些基本曲线:

椭圆滤镜
图2. s平面上的椭圆低通滤波器的对数幅度。白点是极点,黑点是零。

一个线索是每等式。如图1所示,多个滤波器之间必须共享某些值,α因此某些极点和零位置必须共享:

alpha和过滤度
图5.通过曲线参数α获得的不同滤光度N。请注意,对于几个滤波器阶数,我们有例如α=0.5α=0.25α=0.75.

特别是,对于具有N极点或零个的滤波器,它们也都出现在具有3nN相同的滤波器中,其中n是任何正整数。


根据用户A_A的要求,展示了极其干燥的幽默,我看了一下Bernoulli的切线作为s平面参数曲线的示例:

伯努利刑法
图4.伯努利刑法

下面的参数曲线给出了伯努利双引理线的左半部分,参数0<a<1,并且在处开始和结束s=0

f(α)=2sin(πα)cos2(πα)+1+i2sin(πα)cos(πα)cos2(πα)+1

使用该极点的参数曲线,我们想以某种方式比较通过方程式获得的不同幅值频率响应。1.一种方法是查看第N个根| ^ h ω | 1 / N的幅度频率响应。它还使我们可以窥视N ∞的情况NN|H(iω)|1/NN

幅度频率响应的第N个根
图3. 一个N极滤波器的幅度频率响应的第个根,其极点相对于曲线参数均匀分布在伯努利的本能线上。在比所示频率更高的频率下,所有曲线均遵循-6 dB / oct(-20 dB / decade)的斜率。在极限情况Ñ →交通有在衍生物的情节中的不连续性ω = 0 小号= 0作为双纽线(两次)交叉于该点的s平面虚轴。NNNω=0s=0

传递函数(等式1)的大小的第个根的极限为 N ,计算公式为:NN

(3)limN|H(s)|1/N=01|1sf(α)|dα=e01log(|sf(α)|)dα,

其中表示可以用自然对数,积分和指数函数计算的乘积积分。像积分一样,积分没有符号表达,必须对伯努利的lemniscate进行数值评估。总而言之,对于该“随机选择”的参数曲线,所得到的幅度频率响应看起来相当无用。


用户Matt L.提到了Lerner过滤器。我对它们的发现,并做了些许解释:

H(s)=k=1mBk(s+a)(s+a)2+bk2B1=1/2,Bm=(1)m+12Bi=(1)k+1 for k=2,,m1,

with pole positions a+ibk such that bmbm1=b2b1=12(bkbk1) for all 3<k<m1. Looks like these poles, while distributed on a line, are not the poles of the complete filter but poles of parallel sections. I have not confirmed what the poles of the complete system are, or whether the Lerner filters are in any useful sense optimal. Reference: C. M. Rader, B. Gold, MIT Lincoln Laboratory Technical Note 1965-63, Digital Filter Design Techniques, 23 December 1965.


4
My English is shaky this morning, so I don't quite understand what you're trying to say, but if it's about more than one way of computing an elliptic filter, I'd suggest finding the book from Lutovac, in the wikipedia's elliptic filter notes (also Dimopoulos), it's quite the eye opener: you can have 7 ways to design an elliptic filter. If this isn't what you meant, please ignore my comment.
a concerned citizen

2
Lerner filters have all their poles on a line parallel to the imaginary axis. They have the advantage of having an approximately linear phase response.
Matt L.

2
The complete filter; but if the poles of all parallel sections lie on the same line, then also the complete filter will have all its poles on that line. You're right about the reference. There's that technical note by Rader and Gold that I usually refer to.
Matt L.

1
OK, which journal are we going for? :D Is there a guiding principle in this? For example, are you looking for a possible parametric that does better than the eliptic in some aspect? (e.g. transition band vs ripple). Another family that might be "interesting" is the *cycloids...But, without an "ordering principle", we can't call "worst, bad, good, best" any of them :)
A_A

2
The comment thread has gone too long. However, just throwing in a parametric |4y(1y)|=1 location for Daubechies wavelet filters ams.org/journals/proc/1996-124-12/S0002-9939-96-03557-5/…
Laurent Duval

Answers:


6

Throughout the answer I will use the mathematical notations, that is, the mathematica equivalent of expressing the magnitude response of a filter in frequency domain. For this, x will be used instead of jω, to better reflect @Olli's question about finding a mathematical parametric curve to approximate filters. Since this is not filter design, the corner frequency is normalized to unity, hence x instead of ω/ωp.


I'm not sure if this is the answer you're looking for, but any filter can be represented through the generic transfer function:

H2(x)=11+ϵp2R2(x)

where ϵp=10Ap/101, and R(x) is the characteristic attenuation function. Ap is the passband attenuation/ripple in dB, but it can also be in the stopband for Cauer/Elliptic, inverse Pascal, or inverse Chebyshev (a.k.a. "Chebyshev Type II"). The latter are expressed as:

H2(x)=11+1ϵs2TN2(x)

For Butterworth, as you've seen:

R(x)=xN

for Chebyshev it's R(x)=TN(x), or the Chebyshev polynomials (cos/acos for x1 and cosh/acosh for x>1), for Elliptic it's:

R(x)=cd(NK1Kcd1(x,k),k1)

In the book from Lutovac, there are some extremely simplistic representations through exact equivalent functions for Elliptic filters. For example, the 2nd order transfer function can be accurately represented through:

R(x)=(1k2+1)x21(1k21)x2+1

where the only dependency is of the modulus k.

These are the known types, for less known types, for example, Legendre, R(x)=PN(x), where PN(x) are the Legendre polynomials, for Pascal filters there's the shifted and normalized version of the Pascal polynomials, which is:

(N+12x+N12N)

The list goes on. Some are approximated differently, for example Gaussian is |H(x)|2=exp(x2), which is expanded with MacLaurin series, about the same thing for Bessel, which is expanded from its Laplace expression exp(s) into its denominator terms as:

ai=(2N1)!2Nii!(Ni)!

There are also more exotic ways to deduce the transfer function, such as Papoulis (Optimum L), and Halpern, both of which use the Legendre polynomials to integrate the response such that the transfer function is monotonically decreasing with high filter selectivity. For Papoulis, it's:

R(x2)=i=12x21(i=0kaiPi(x))2

where k is (N1)/2, and ai are some cleverly chosen terms, depending on whether N, or k, both, are odd/even.

As noted, all these don't use the frequency domain for representation, as in x is the mathematical x, real, not imaginary jω. Solving for the roots can either be done by simply finding the poles (and zeroes) for the transfer function when replacing x with jω., thus finding out H(s)H(s) and selecting the Hurwitz polynomial, or by simply finding the roots of the mathematical expression in x (see the link in the 2nd comment, below). This will yield the roots rotated by 90 degrees, which means all there is to do is to switch the real and imaginary parts between themselves and then select the righ-hand side.

Is this answer close to what you were searching for?


I think, at this point, it's important to say that filters don't exist because people were throwing darts at a map to mark down the poles, they came to be after careful considerations about the goal they had in mind.

For example, and going in approximately increasing quality, Butterworth filters came to be because there was a need for a filter that was simple to design, with monotonically increasing attenuation. Linkwitz-Riley are nothing but Butterworth in (clever) disguise such that summing a lowpass and a highpass with the same corner frequency results in a flat response, useful for audio applications.

Chebyshev (I and II) were designed to have better attenuation, at the cost of ripples in passband or stopband. Legendre, ultraspherical, Pascal (and possibly others) minimize the ripple, thus improving group delay, at the cost of slightly reduced attenuations.

Papoulis and Halpern were developed as a mix between passband ripple and monotonically increasing attenuation, while improving the attenuation around the corner frequency, at the cost of a droop in the passband.

Cauer/Elliptic filters make use of ripple in both passband and stopband in order to minimize the required order for the same, or better, attenuation.

All these are in the frequency domain, which most filters are. Going the other way, Bessel filters came to be because of the need to approximate an analog delay, so they converge towards exp(jω) as the order increases, while Gaussian filters were created for zero overshoot, thus they approximate exp(x2) with increasing order.

Of course, as someone suggested, you can also sprinkle poles and see what comes out, maybe configure them as a star, or some honey-comb pattern, choose your favourite lemniscate, but that's not the way to do it if you want a filter out of it. Sure, you may get an exotic response that may even be applicable who-knows-where, as a single case out of a million, but that's really just a particular case. The way to go is to first impose a design goal and see how can that goal be achieved in terms of a physically realizable filter. Even if that means coming up with a who-knows-where applicable filter. :-)


Given the recent answer from @Olli, consider the simple case of a Butterworth filter, designed for, say 0.9@fp=1, 0.1@fs=5. The calculations are something like this:

Ap=20log10(0.9)=0.91515 dBAs=20log10(0.1)=20 dBϵp=10Ap/101=0.48432ϵs=10As/101=9.94987F=fsfp=51=5N=logϵsϵplogF=1.878

N is calculated as rounded up, so N=2. This means that, if you match the filter's response to the passband, you'll get a higher attenuation in the stopband @fs. Using the first formula up, the attenuation@fs is:

H(fs)=11+0.48432252N=0.08231<0.1

If you'd have to match the stopband to have 0.1@fs, you'd have to apply a frequency correction:

ωscale=(ϵsϵp)1/Nfpfs=9.949870.5=0.9065H(5ωscale)=0.1

So ωscale can vary from 1 to 0.9065 and you'll get all the infinite possibilities in between the two extremes. Can you do it? Yes. Is it worth it? Even if you might find an argument or two, the general answer is still no. How was all this possible? Because the initial response of the Butterworth filter was already obtained, so you knew beforehand that you had an analytical expression for a filter that has monotonically decreasing frequency attenuation, which lead to finding out the poles from the denominator of the transfer function, which happen to lie on a circle with equal angles.


Given the recent answer from @Olli, there are a few things that need spelling out. First, all this is about filter design, no matter how you look at it: from a mathematical or from a physical realizability point of view.

If it is mathematical, then there is some interesting part about the theory of it, namely obtaining a different order from the same filter without the need for re-designing the original filter.

But from a physical realizability point of view, the whole process implies some extra, unneeded work, that (should) lead to the same result, and that is precisely the part about the increasing/decreasing the filter's order to obtain a new one. My arguments are as follows.

Any filter, at its core, serves to filter unneeded frequencies, be they electrical, or mechanical, or other physical quantities. Their purpouse is to modify a spectrum (or group delay, or time response). If there is the need for such a device, then that device cannot be designed by simply throwing in a filter of any kind, "just put it there, it'll filter out stuff"; its design is, most often, quite involved. But all this process has to start from the requirements. That is, first there has to be a specific goal, "let's filter out everything above 100 Hz", or "let only the infrared light pass through", or anything similar, which starts by first determining the parameters with which that filter has to work.

As a quick example, if there was a need to filter out frequencies below 300 Hz and above 3000 Hz, one wouldn't just throw in any bandpass filter with those corner frequencies, attenuations must be also specified, whether ripple in the passband, or stopband, or both, is needed or accepted, whether the phase is linear or not, how will the group delay affect all this, etc. So, first of all, there are specific parameters by which the filter needs designing.

Once the parameters are specified, how will the filter be designed? Let's presume that there is a need for a 12th order elliptic lowpass filter, and that there is a possibility to increase a low order filter to a high order one (see @Olli's answer). Let's say that the process of transforming a 4th order into a 12th order is a flawless one, that there is a way to specify the design parameters for the 4th order filter in such a way that, after transforming, the resulting 12th order would end up satisfying those conditions. "Premeditated thinking", if you will.

The question that comes is this: how will the 4th order filter be designed? The answer can only be through the known ways of designing it. And, if there are other methods, to come, or yet to be invented, those would have to be applied, first, in order to design that 4th order filter. Only afterwards the 12th order can be calculated. As assumed from the beginning, even with a flawless transformation process it would only mean that the resulting filter, the 12th order, towards which the whole design tries to converge, needs two steps of design: one, for the 4th order, and the second, for the 12th order, making the whole process an unnecessarily encumbered one, since the 12th order filter could have simply been designed, in the first place, with the method used for the 4th order.

Let's go a bit further and assume some more. The resulting poles of the 12th order would lie on an ellipse, and the zeroes on the imaginary axis. The distances between them would be precisely defined by the underlying elliptic functions that govern the elliptic filters. Suppose there is a way to define those curves, as @Olli hopes, in such a manner that it is possible to readily design a filter from the beginning, in one shot, by simply using these (parametric or not) curves by which all the pole placement is done. So far, so good. But those curves would have to first be calculated, and the parameters by which they unravel are the exact ones that are used for the filter design, the same ones that would generate the filter through other methods, known or yet unknown. What's more, the calculations are still left to be done, and, most probably, the underlying definitions for those parametric curves would have to be elliptical, one way or another, or no elliptical filter would come out of it[note#1]. Which means that the whole process would simply be yet another method of design for the elliptic filters, since the poles of the elliptical filter have closed form expressions, already.

Don't get me wrong. If one filter can be designed one way, the same way it can be designed in another. It's just one of those "yet to be known" ways. Bravo to the inventor. But if this method of design implies extra steps in order to converge to the same results it would take for a different method, then it doesn't seem like a feasible approach. And please note: I am not using names or descriptive labels when I am talking about the filter designs, just generic names, because it doesn't really matter which method you're using as long as the results are correct and the method isn't encumbering for the design process.

[note#1]: Simply following a generic curve in order to place the poles is not enough, and I'll give two examples, related to the Butterworth filters, who have the poles placed on a circle with equidistant angles. Chebyshev type I filters have the poles placed on an ellipse, with the angles of the Butterworth, but projected on the imaginary axis until they intercept the ellipse. Modifying the distance between the poles will result in a non-equiripple behaviour, rendering the filter a non-Chebyshev type. Similarly, the poles of the minimum-Q elliptic filter are disposed on an underlying circle, but that doesn't mean it's a Butterworth (even if the ripple is the minimum possible for an elliptic filter), because it has unequal distances between the angles. For the last one, here's a comparison of two 8th order Butterworth and minimum-Q elliptic:

Butterworth vs min-Q elliptic

Overall, despite the genuine interest the question brings, I fear it has no more than a theoretical value, at best an educational one, since it doesn't manage to fit the very part dealing with the filter design. Of course, if it should prove to be of actual value, I'd be glad to be proven wrong, as it would mean that there is a new method of filter design, possibly better than the already existent ones.


@OlliNiemitalo Yes, it's the non-squared version. Do what the priest says, not what he does. :-) Ap is the passband attenuation/ripple, in dB, but it can also be for the stopband, in the case of Cauer/Elliptic, inverse Chebyshev, or inverse Pascal. I see there are other minor mistakes, I'll edit them.
a concerned citizen

1
Olli, there are nice closed-form expressions for both Tchebyshevs and the Butterworth. but not so much for the Elliptical/Cauer filter. getting a well-defined alg down for that (the loci of poles and zeros) is (how shall we say?) a copulating female canine.
robert bristow-johnson

1
@robertbristow-johnson Despite the accurate scientific synonim, there are at least 3 ways to represent the poles for Cauer. One is the approximation (Antoniou?, Dimopoulos?, not sure), which, I think it's the widest used. Then there's Burrus's way which accurately follows elliptical functions, i.e. the zeroes are ±j/(ksn(iK/N,k)),i=1,2,.. (different odd/even), but that requires using theta functions and whatnot, which gets very "fluffy" in terms of CPU. Then there's Lutovac, who, even if he can't use prime numbers, greatly simplifies them, but they get bigger as the order increases.
a concerned citizen

1
@robertbristow-johnson Me neither, as mentioned at the end of the original edit, and in one of the comments, but it looks like it got edited along the way, I'll correct it. As for the elliptic functions, Burrus and another one (forgot the name, Paarman?) use the sn(K+sn1()) version, but sn(K+x)=cd(x), the shifted Jacobi sine, a fact noted by Lutovac. So, to avoid the need to calculate an extra complete elliptic integral, one can write cd(), there's no difference. A simple plot can show it (k1=ϵp/ϵs,k=fp/fs,K1=K(k1),K=K(k)).
a concerned citizen

1
@robertbristow-johnson You missed the part where I say that all the expressions use x as a variable, because they reflect the mathematical function that describes the filter response, since it's related to the mathematical approach of Olli's. Plotting all the functions with x in any mathematical software will get you the magnitude, without going into frequency domain. I left outside replacing x=jω, making H(s)H(s), and selecting only the Hurwitz criterion poles/zeroes, that is for filter design. Besides, you can get the poles without that, just as well (see link in comment#2).
a concerned citizen

2

While I intuitively feel that I understand what is required, I struggle to express it. I am not sure if this is because of my own limitations or if indeed the problem is difficult or ill-posed. I have a feeling that it is ill-posed. So, here is my attempt:

  1. The objective is to build a filter. That is, calculate a set of coefficients of some rational form:

H(s)=B(s)A(s)=m=0MbmsmsN+n=0N1ansn

(Please note, it doesn't have to be over the s-plane, it could be over the z-plane too. And also, simpler forms of it could be considered (e.g. H(s) to have only poles). Let's run with the s-plane for the moment and let's keep the nominator in too).

  1. Digital filters are characterised by their frequency and phase responses, both of which can be completely determined by the values (or, positions on the s-plane) of their an,bm coefficients. The discussion so far seems to be focusing on the frequency response so let's consider that one for the moment.

  2. Given a set of some an,bm and some point σ+jω on the s-plane, the geometric way of deriving the frequency response at that point is to form "zero vectors" (from the locations of the zeros, towards the specific point) and "pole vectors" (similarly for the poles), sum their magnitudes and form the ratio as in the equation above.

  3. To ask "What [...] filter types defined by some optimality criterion have infinite subsets defined by parametric curves [...]" is to ask "What is the pair of some parametric curves A(s,Θ),B(s,Θ) whose locations also result in a magnitude response curve with specific desired characteristics over Θ (e.g. slope, ripple, other). Where Θ is the parameter(s) of the...parametric.

  4. A note, at this point: On the one hand, we are looking for A(s),B(s) that satisfy two constraints. First of all they have to satisfy the constraints of the parametric (easy) and secondly they have to satisfy the constraints specified by the magnitude response characteristic (difficult).

  5. I think that the problem, in its current form, is ill-posed because there is no analytic way to connect the frequency response constraints with the parametrics A(s,Θ),B(s,Θ), except the direct evaluation of it. In other words, it is impossible at the moment to specify some constraints on the frequency response curve and through that, work backwards and find those parametrics that satisfy these constraints. We can go the other way around, but not backwards.

  6. Therefore, what (i think that) realistically can be done, at the moment, is to accept A(s,Θ),B(s,Θ) of some specific form and then, either check how do they fare as filters OR, iteratively move their coefficients around as much as their parametric allow, to squeeze the best performance they can offer out of a particular range of their Θ. However, we might find that given the worked out characteristics of elliptics (for example), a given iterative scheme on a parametric might choose to "bend" the coefficients as close as possible to some "elliptic" region characteristic. This is why earlier on, I mention that we might find that a complex parametric might be possible to be broken down to a "sum of elliptics" or a "sum of curves with known characteristics". Perhaps a third constraint is required here, reading "Stay away from known configurations of A(s),B(s)", in other words, penalise solutions that start looking like elliptics (but still in an iterative scheme).

Finally, if this path is not too wrong so far then we are somewhere close to something like Genetic Algorithms For Filter Design, or some other informed "shoot in the dark" technique by which the coefficients of a filter satisfying specific criteria might be derived with. The above is just an example, there are more publications along these lines out there.

Hope this helps.


+1 I like your program. For your point #4 and others, the optimization goal could be stated in terms of limN(H(iω))1/N, or usually its absolute value. Then again it would mean we are already relying on the the viability of the approach, which is in question. So it would be necessary to also check with some finite N filters. In point #7, I don't think "repulsion of elliptics" would help as it would give sub-optimal near-elliptic filters. Rather, the optimization goal should be changed.
Olli Niemitalo

1
Thank you. I agree that the optimisation goal is crucial here. "Repulsion of the eliptics" should be used more often... :)
A_A

2

i don't think it's particularly remarkable that Butterworth filters, defined as all-pole filters that are maximally flat at ω=0 (for LPF prototype, meaning the most possible derivatives of |H(jω)| are zero at ω=0), have s-plane poles that lie equally spaced on the left half-circle of radius ω0.

from the "maximally flat" and "no zeros", you can derive

|H(jω)|2=11+(ωω0)2N

for the Nth-order Butterworth.

so

|H(s)|2=11+(sjω0)2N

s=pn is a pole when the denominator is zero.

1+(pnjω0)2N=0

or

(pnjω0)2N=1

pn2N=(jω0)2N

|pn|=ω0

2Narg{pn}=π+2Nπ2+2πn

arg{pn}=π2+πN(n12)

for Nth-order Tchebyshev (Type 1, which is all-pole), it's like this:

|H(jω)|2=11+ϵ2TN2(ωωc)

where

TN(x){cos(Narccos(x)),if |x|1cosh(Narccosh(x)),if x1(1)Ncosh(Narccosh(x)),if x1

are the Nth-order Tchebyshev polynomials and satisfy the recursion:

T0(x)=1T1(x)=xTn+1(x)=2xTn(x)Tn1(x)nZ1

and ωc is the "passband cutoff" frequency and not to be confused with the -3 dB frequency ω0. (but the two are related.)

the passband ripple parameter is ϵ=10dBripple101

analytic extension again:

|H(s)|2=11+ϵ2TN2(sjωc)

and again s=pn is a pole when the denominator is zero.

1+ϵ2TN2(pnjωc)=0

or

TN(pnjωc)=±jϵ

(because cos(θ)=cosh(jθ) we can use either cos() or cosh() expression for TN()

cosh(Narccosh(pnjωc))=±jϵ

Narccosh(pnjωc)=arccosh(±jϵ)

since

y=cosh(x)=12(ex+ex)
and
x=arccosh(y)=log(y±y21)

then

Nlog(pnjωc±(pnjωc)21)=log(±jϵ±(±jϵ)21)

Nlog((pn)+j(pn)jωc±((pn)+j(pn)jωc)21)=log(±j(1ϵ±1ϵ2+1))

Nlog(j(pn)+(pn)ωc±(j(pn)+(pn)ωc)21)=log(±j(1ϵ±1ϵ2+1))

oh dear i might not get this blasted out in 12 hours

i've decided that i am too lazy to grok through this. if anyone wants to pick it up, feel free to. lotsa conversion between rectangular and polar notation of complex values. remember when

w=± z 
then
|w|=+|z|
and
arg{w}=12arg{z}+arg{±1}=12arg{z}+π2(1±1)

and remember

log(z)=log|z|+jarg{z}+j2πnnZ

you may add any integer multiple of 2π (say "2πn") to any arg{} (choose the right-hand log() which is how you can get different poles for pn).

if you like mathematical masturbation with complex variables, knock yourself out.


+1 for the interesting observation, but since this doesn't address the questions I hope there will be other candidates for the bounty.
Olli Niemitalo

so Olli, you can see how the derivation of the poles for Tchebyshev 1 and poles/zeros for Tchebyshev 2 is similarly done?
robert bristow-johnson

the Jabobi Elliptical is a bitch. i dunno how to evaluate it without looking it up in Antonio. and it ain't gonna be closed form.
robert bristow-johnson

Yes, the zeros of Tchebyshev 2 are uniformly distributed on parametric curve f(α)=j/cos(πα) for cutoff 1.
Olli Niemitalo

and how do you get that result and the loci of the poles for either Tchebyshev 1 or 2?
robert bristow-johnson

0

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: Shared poles and zeros
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);

12th order filter magnitude frequency response
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)));

Poles and zeros, filter order 12
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);

Fourth order filter magnitude frequency response
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");

4th order filter pole/zero comparison
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);

Magnitude frequency response of the 4->12th order interpolated filter
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)));

Comparison of poles and zeros for N=12
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);

6th order <code>ellip</code>-generated filter
18th order filter derived from the
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=1N as:

(1)szi=jksn(K+K(2i+1)/N,k),

where K is a quarter period of sn(t,k) for real t, and 0k1 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:

(2)fz(α)=jksn(K+2Kα,k),

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=1N with any N as:

(3)spi=cn(K+K(2i+1)/N,k)dn(K+K(2i+1)/N,k)sn(ν0,1k2)×cn(ν0,1k2)+jsn(K+K(2i+1)/N,k)dn(ν0,1k2)1dn2(K+K(2i+1)/N,k)sn2(ν0,1k2),

where dn(t,k)=1k2sn2(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 1k2, 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:

(4)fp(α)=cn(K+2Kα,k)dn(K+2Kα,k)sn(ν0,1k2)×cn(ν0,1k2)+jsn(K+2Kα,k)dn(ν0,1k2)1dn2(K+2Kα,k)sn2(ν0,1k2).

Let's plot the functions and the curves in Octave, for values of k and ν0 (v0in 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]);

Analytic extensions of parametric curve functions for Burrus Example 3.4
Figure 9. fz(α) and fp(α) for Burrus Example 3.4, analytically extended to period α=02. 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]);

Parametric curves for Burrus Example 3.4
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.


Olli, you can't give yourself the bounty anyway. your 500 points are gone forever. just don't waste them like i did accidentally once at the EE.SE page.
robert bristow-johnson

Comments are not for extended discussion; this conversation has been moved to chat.
jojek

1
Yes, they still are, that is the special case for odd orders, when there's an additional, single, real pole, re/(s+re), to the transfer function. As for the rational function starting from zeroes, only, you have:
R(x)=in/2x2zeroi2jn/2x2k/zeroj2
, where k=fs/fp. For odd orders, R(x)=R(x)x. This will make the filter have unnormalized gain, so it should be scaled by R(0). Poles come from expanding 1+ϵ2R2(x) and finding the roots of the denominator, then selecting the left-hand side, and forming the transfer function.
a concerned citizen

I wasn't sure if I said this. To make the transfer function, it's not really necessary to follow the book by making H(s)H(s), then left-hand side poles, then rational transfer function according to @A_A's formula. Mathematically, and the practical result, is that after finding the roots from 1+ϵ2R2(x) (note: x, not jω, or s), simply select the roots with the positive realparts and either positive or negative imagparts (not both). I.e. for N=4, there would be 4 pairs/8 poles; after selection you have 2 different poles. Then simply:
N(s)=iN/2|pi|2
...
a concerned citizen

(for all-pole filters), where p=σ+jω, and
N(s)=iN/2s2+|zi|2
, where z=jμ (for pole-zero filters), while the denominator:
D(s)=jN/2s2+2Re(pj)s+|pj|2
and
H(s)=N(s)D(s)
. This would be the lowpass prototype.
a concerned citizen

0

It seems that most of the participants in this discussion do not know a type of filter which may be their real solution ! Namely the Paynter filters developed by Henry M.Paynter who was a professor at MIT and partner of Philbrick Reseach. They are the best approach to "running" average filtering and treating non deterministic input signals, far better than Bessel-Thomson. I used them for physiological-medical and sonar applications. Their theories are in the January-July and July-October editions of the "Lightning Empiricist" under the general title: "New approaches for the design of Active Low Pass Filters" by Peter D. Hansen Tables are given for the poles of the 2nd, 4th and 6th order filters. I computed the same for the 8th order.


And it would seem you missed OP's point: to find the Holy Graal of mathematical formulas that can be used to calculate any filter type (or similar). :-)
a concerned citizen

0

I'll add here some notes that may be useful if someone wants to calculate the limit N of the Nth root of magnitude of a transfer function with a multiple of N poles and zeros distributed on arbitrary parametric curves. One could approximate that by using a large N and by distributing the poles and zeros uniformly over the parameter of the parametric curve. Unfortunately the approximation always has infinite error on dB scale at the locations of the poles and zeros of the realizable transfer function. In that sense a better building block is a line segment with uniform pole or zero distribution along its length. Considering just N zeros, distributed on a line segment with start point x0+y0i and end point x1+y1i:

limN|H(0)|1/N=01|(x0+y0i)(1α)+(x1+y1i)α|dα=01((x0(1α)+x1x)2+(y0(1α)+y1α)2)dα=e01log((x0(1α)+x1α)2+(y0(1α)+y1α)2)dα=e((x0y1x1y0)atan2(x0y1x1y0,x0x1+y0y1)(x0x1)2+(y0y1)21)×(x02+y02)(x1(x0x1)+y0(y0y1)+(x0x1)22((x0x1)2+(y0y1)2))×(x12+y12)(x0(x1x0)+y1(y1y0)+(x1x0)22((x1x0)2+(y1y0)2))

Some special cases need to be handled separately. If x0=0 and y0=0 we must use the limit:

=e1x12+y12

Or conversely if x1=0 and y1=0:

=e1x02+y02

Or if the line segment has zero length, x0=x1 and y0=y1, we have just a regular zero:

=x02+y02

To do the evaluation at different argument values of H(z) or H(s), simply subtract that value from the line start and end points.

What this looks like on the complex plane: Magnitude of the transfer function with a single zero
Figure 1. Magnitude of the transfer function with a single zero. 1 dB steps are indicated in turquoise and 10 dB steps in yellow.

The limit N->inf of the Nth root of magnitude of a transfer function with N zeros uniformly distributed on a line segment
Figure 2. The limit N of the Nth root of magnitude of a transfer function with N zeros uniformly distributed on a line segment. There is a crease at the line segment, but the value never goes to zero like with a regular, realizable zero. At sufficient distance this would look like a regular zero. The color code is the same as in Fig. 1.

enter image description here
Figure 3. An approximation of Fig. 2 using discrete zeros: 5th root of the magnitude of a polynomial with 5 zeros distributed uniformly on the line segment. At the location of each zero, the value is zero, because 01/5=0.

Figs. 1 and 2 were generated using this Processing sketch, with source code:

float[] dragPoints;
int dragPoint;
float dragPointBackup0, dragPointBackup1;
boolean dragging, activated;
PFont fnt;
PImage bg;
float pi = 2*acos(0.0);
int appW, appH;
float originX, originY, scale;

int numDragPoints = 2;

void setup() {
  appW = 600;
  appH = 400;
  originX = appW/2;
  originY = appH/2;
  scale = appH*7/16;
  size(600, 400);
  bg = createImage(appW, appH, RGB);
  dragging = false;
  dragPoint = -666;
  dragPoints = new float[numDragPoints*2]; 
  dragPoints[0] = originX-appW*0.125;
  dragPoints[1] = originY+appH*0.125;
  dragPoints[2] = originX+appW*0.125;
  dragPoints[3] = originY-appH*0.125;
  fnt = createFont("Arial",16,true);
  ellipseMode(RADIUS);
  activated = false;
}

void findDragPoint() {
  int cutoff = 49;
  int oldDragPoint = dragPoint;
  float dragPointD = 666666666;
  dragPoint = -666;
  for (int t = 0; t < numDragPoints; t++) {
    float d2 = (mouseX-dragPoints[t*2])*(mouseX-dragPoints[t*2]) + (mouseY-dragPoints[t*2+1])*(mouseY-dragPoints[t*2+1]);
    if (d2 <= dragPointD) {
       dragPointD = d2;
       if (dragPointD < cutoff) {
         dragPoint = t;
       }
    }
  }
  if (dragPoint != oldDragPoint) {
    loop();
  }
}

void mouseMoved() {
  if (activated) {
    if (!dragging) {
      findDragPoint();
      loop();
    }
  }
}

void mouseClicked() {
  if (dragPoint < 0) {
    activated = !activated;
    if (activated) {
      findDragPoint();      
    }
  }
  loop();
}

void mousePressed() {  
  if (dragPoint >= 0) {
    dragging = true;
    dragPointBackup0 = dragPoints[dragPoint*2];
    dragPointBackup1 = dragPoints[dragPoint*2+1];
  } else {
    dragging = false; // Not needed?
  }
  loop();
}

void mouseDragged() {
  if (!activated) {
    dragPoint = -666;
    activated = true;
    findDragPoint();
  }
  if (dragging) {
    int x = mouseX;
    int y = mouseY;
    if (x < 5) {
      x = 5;
    } else if (x >= appW - 5) {
      x = appW - 6;
    }
    if (y < 5) {
      y = 5;
    } else if (y >= appH - 5) {
      y = appH - 6;
    }
    dragPoints[dragPoint*2] = x;
    dragPoints[dragPoint*2+1] = y;
    loop();
  }  
}

void mouseReleased() {
  if (activated && dragging) {
    dragging = false;
    loop();
  }
}

float sign(float value) {
  if (value > 0) {
    return 1.0;
  } else if (value < 0) {
    return -1.0;
  } else {
    return 0;
  }
}

void draw() {
  for(int y = 0; y < appH; y++) {
    for(int x = 0; x < appW; x++) {
      float x0 = (dragPoints[0]-x)/scale;
      float y0 = (dragPoints[1]-y)/scale;
      float x1 = (dragPoints[2]-x)/scale;
      float y1 = (dragPoints[3]-y)/scale;
      float gain;
      if (x0 == x1 && y0 == y1) {
        gain = sqrt(x0*x0 + y0*y0);
      } else if (x0 == 0 && y0 == 0) {
        gain = exp(-1)*sqrt(x1*x1 + y1*y1);
      } else if (x1 == 0 && y1 == 0) {
        gain = exp(-1)*sqrt(x0*x0 + y0*y0);
      } else {
        gain = exp((x0*y1 - x1*y0)*atan2(x0*y1 - x1*y0, x0*x1 + y0*y1)/(sq(x0 - x1) + sq(y0 - y1)) - 1)*pow(x0*x0 + y0*y0, (x1*(x0 - x1) + y0*(y0 - y1) + sq(x0 - x1))/(2*(sq(x0 - x1) + sq(y0 - y1))))*pow(x1*x1 + y1*y1, (x0*(x1 - x0) + y1*(y1 - y0) + sq(x1 - x0))/(2*(sq(x1 - x0) + sq(y1 - y0))));
      }
      int intensity10 = round(log(gain)/log(10)*0x200)&0xff;
      int intensity1 = round(log(gain)/log(10)*(0x200*10))&0xff;
      bg.pixels[y*appW + x] = color(intensity10, 0xff, intensity1);
    }
  }
  image(bg, 0, 0);
  noFill();
  stroke(0, 0, 255);
  strokeWeight(1);
  line(dragPoints[0], dragPoints[1], dragPoints[2], dragPoints[3]);  

  //ellipse(originX, originY, scale, scale);  
  if (!activated) {
    textFont(fnt,16);
    fill(0, 0, 0);
    text("Click to activate",10,20);
    for (int x = 0; x < appW; x++) {
      color c = color(110*x/appW+128, 110*x/appW+128, 110*x/appW+128);
      set(x, 0, c);  
    }
    for (int y = 0; y < appH; y++) {
      color c = color(110*y/appH+128, 110*y/appH+128, 110*y/appH+128);
      set(0, y, c);  
    }
  }

  for (int u = 0; u < numDragPoints; u++) {
    stroke(0, 0, 255);
    if (dragPoint == u) {
      if (dragging) {
        fill(0, 0, 255);
        strokeWeight(3);
        ellipse(dragPoints[u*2], dragPoints[u*2+1], 5, 5);
      } else {
        noFill();
        strokeWeight(3);
        ellipse(dragPoints[u*2], dragPoints[u*2+1], 6, 6);
      }
    } else {
      //noFill();
      //strokeWeight(1);
      //ellipse(dragPoints[u*2], dragPoints[u*2+1], 6, 6);
    }
  }
  noLoop();
}
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.