-
-
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: signal: remezord implementation #4122
Conversation
I think, remezord() should have a Stopband Attenuation param, to input a Stopband Attenuation (dB) list. firpmord() in mathlab, can input Passband Ripple (dB) and Stopband Attenuation (dB) both. is the rips param in remezord() equal to the dev param in firpmord()? |
Can I rewrite this matlab code to python? as below:
change to: [n,fo,ao,w] = remezord(f,a,dev,fs);
b = remez(n,fo,ao,w, fs); |
There is still an unresolved discussion about whether ripples are defined correctly. Other things that need to be addressed:
|
yes, it seems have some problems. fs = 1200000 # 1200 KHz.
# bandpass, 269 KHz - 392 KHz.
fstop1 = 269000 - 6780
fpass1 = 269000
fpass2 = 392000
fstop2 = 392000 + 6780
dstop1 = 0.002 # First Stopband Attenuation (dB)
dpass = 0.019 # Passband Ripple (dB)
dstop2 = 0.002 # Density Factor
dens = 20
N, Fo, Ao, W = remezord([fstop1, fpass1, fpass2, fstop2],
[0, 1, 0], [dstop1, dpass, dstop2], fs)
bpf = remez(N, Fo, Ao, W, fs, grid_density = 20)
w, h = freqz(bpf)
plt.plot(w * fs / 2 / np.pi, 20 * np.log10(abs(h)))
plt.ylabel('Amplitude [dB]')
plt.xlabel('Frequency [Hz]')
plt.grid()
plt.show() and if i input param as firpmord() in matlab, the output frequency is half of except. as below: fs = 1200000 # 1200 KHz.
# bandpass, 269 KHz - 392 KHz.
fstop1 = 269000 - 6780
fpass1 = 269000
fpass2 = 392000
fstop2 = 392000 + 6780
dstop1 = 0.002 # First Stopband Attenuation (dB)
dpass = 0.019 # Passband Ripple (dB)
dstop2 = 0.002 # Density Factor
dens = 20
N, Fo, Ao, W = remezord([i/fs/2 for i in [fstop1, fpass1, fpass2, fstop2]],
[0, 1, 0], [dstop1, dpass, dstop2])
bpf = remez(N, Fo, Ao, W, grid_density = 20)
w, h = freqz(bpf)
# the plot result is half of (269 KHz - 392 KHz).
plt.plot(w * fs / 2 / np.pi, 20 * np.log10(abs(h)))
# use this line, the plot result is correct.
# plt.plot(w * fs / np.pi, 20 * np.log10(abs(h)))
plt.ylabel('Amplitude [dB]')
plt.xlabel('Frequency [Hz]')
plt.grid()
plt.show() |
and i need this funciton now, wich function can replace it? |
@zaazbb I'm not sure, I'm not aware of a |
@charris IIRC you know this stuff quite well and still have some |
I'll take a look at it. Know quite well means I studied it a bit some years ago ) |
@nils-werner are you interested in coming back to this? It looks like you force pushed an update four years ago that nobody saw (GitHub does not notify for force push updates). If the comments above are addressed and you're still interested in working on this we can review. If not perhaps we should close? |
Yes, I would be interested to give this another go. |
Any updates on this? I can give it a try since it looks like mostly bureaucracy.
|
I think that would indeed be nice, thanks @luxedo. |
continued in #20983 |
Rebased remezord implementation as mentioned in #1002