-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
ENH: tf2zpk positive or negative powers #4872
base: main
Are you sure you want to change the base?
Conversation
If I'm correct All that matters then is that you can distinguish between a analog and a digital signal. Therefore, I think the option |
Well it's common to write digital filters as positive powers, too, typically in control systems: http://www.nptel.ac.in/courses/108103008/22 I thought writing But yes, there are only 2 options. |
The CI is failing because |
ok fixed that |
Does |
I like |
If you can write digital filters with positive powers as well, then you have 3 options, like you offer for I can't think of any good name for |
|
3809d94
to
2984535
Compare
Change `var` argument to `negative_powers` boolean. Change eqtflength to private function for now.
Ok I changed |
More doctest failures, in one certain version, due to printing arrays differently. Should I remove the print statement then? A guide on the best way to write doctests would be nice. |
The (modified) doctest checker does not understand the array-print syntax, |
Analog vs digital doesn't matter here. It's just finding the poles and zeros of rational functions, which is the same either way. Analog is typically written as positive powers and digital is typically written as negative, but both could be written either way. Also this parameter should be added to all the other functions that deal with |
Actually not necessary for |
(and do I also need to do this for zpk2tf?) |
Matlab has 2 functions,
tf2zp
for positive power transfer functions andtf2zpk
for inverse powers. Instead of making 2 separate functions I added avar
parameter to specify the variable. I usedvar={'s', 'z', 'z^-1'}
, similar to Matlab'stf
command. (The actual variable name is ignored and only the^-1
part matters.) Python doesn't usez^-1
notation for exponents, so it could be changed toz**-1
instead.It could alternatively be something like
negative_powers=True
.Also added the
eqtflength
function which it depends on. This could be renamed instead of using Matlab's name.Matlab's function can also output n and m, the orders of the original numerator and denominator. I don't know what this is used for, but it could be added later with an
output=
parameter if needed.