I've read the similar question Find the equivalent of this python remez specs in C++ remez or Matlab firpm, which describes a different problem.
In Matlab, I have following remez
and firpm
function calls:
remez(10,[0 .1 1-.1 1],[1 1 0 0])
firpm(10,[0 .1 1-.1 1],[1 1 0 0])
and in Scipy, I can achieve the same filter by calling:
signal.remez(11, bands=[0, .1, 1.0 - .1, 1], desired=[1, 0], fs=2)
Both 3 function calls returns me the same coefficients:
ans =
0.0066 -0.0000 -0.0510 0.0000 0.2944 0.5000 0.2944 0.0000 -0.0510 -0.0000 0.0066
The problem is: when I attempt to sharpen the corner frequency from the half pass filter, by substituting the Δf = .1
to Δf = .01
, the output from Scipy is an array of nan
.
remez(10,[0 .01 1-.01 1],[1 1 0 0])
firpm(10,[0 .01 1-.01 1],[1 1 0 0])
both Matlab calls returns me the same filter coefficients:
ans =
0.0059 -0.0000 -0.0488 0.0000 0.2930 0.5000 0.2930 0.0000 -0.0488 -0.0000 0.0059
By attempting to get the same filter from Scipy,
signal.remez(11, bands=[0, .01, 1.0 - .01, 1], desired=[1, 0], fs=2)
the result is:
array([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan])
I don't know exactly if there's something wrong with the arguments or maybe a precision problem in the Python call. Any help is appreciated!