Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong elliptic filter ripple configuration #12

Closed
ToGoOrNotToGo opened this issue Jul 29, 2019 · 4 comments
Closed

Wrong elliptic filter ripple configuration #12

ToGoOrNotToGo opened this issue Jul 29, 2019 · 4 comments

Comments

@ToGoOrNotToGo
Copy link

The elliptic filter ripple configuration in FiltersForm.AnalyzeEllipticFilter is converted to magnitude Db. But in PrototypeElliptic.Poles and PrototypeElliptic.Zeros it is converted as power Db. So my suggestion is not to use Db here. Or I am wrong?

@ar1st0crat
Copy link
Owner

Hi! The code is based on this wonderful pdf: http://eceweb1.rutgers.edu/~orfanidi/ece521/notes.pdf. Take a look at derivations at page 2. For instance, -20log(Gp) = 10log(1 + eps^2). The right side is programmed, but it was derived from magnitude dB. Also, IIRC, I tested it - the method worked as expected. Maybe I'm missing something, though, but the code seems to be OK.

Also, in FiltersForm the code is:

var ripplePassDb = Utils.Scale.ToDecibel(1 / deltaPass);

because 20log(1/d) = -20log(d). So the code is similar to MATLAB code from the pdf.

@ToGoOrNotToGo
Copy link
Author

ToGoOrNotToGo commented Jul 30, 2019

Ah OK. So parameter "rippleStop" means the stopband ripple, in decibels (stopbandRipple) and parameter "ripplePass" means the stopband attenuation, in decibels (stopbandAttenuation)?

@ar1st0crat
Copy link
Owner

Not sure if I understood you correctly. Fig.1 at page 2 from the pdf should help (I'm using the same notation):

Passband gain: Gp
Passband ripple (Gp in dB): Ap = -20log(Gp) = 20log(1/Gp)
Stopband (attenuation) gain: Gs
Stopband (attenuation) ripple (Gs in dB): As = -20log(Gs) = 20log(1/Gs)

Ap and As are passed as parameters to EllipticFilter constructor (i.e. values in dB).

This is what the notation is in the pdf. I like the term 'attenuation' better because this value defines the amplitude loss (not the max amplitude of fluctuations in stopband) according to Fig.1. And the passband gain (ripple) here means also the max amplitude loss compared to level=1.0. Often it has slightly different meaning - illustrated here (when the center of oscillations is at level 1.0 : { 1-d, 1+d }). This one is used in Remez class.

@ToGoOrNotToGo
Copy link
Author

Thanks a lot! Yes, the different terms make it difficult to learn...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants