How to calculate passband and stopband coefficients for signal filtering?
48 次查看(过去 30 天)
显示 更早的评论
Hi All
using the following code, I need that my passband frequency be 250 Hz , and the Stop Band at 512 Hz. how do I calculate Wp and Ws to insert in the code ?
Ts = 0.001; % Sampling Interval (s)
Fs = 1/Ts; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = 0.001; % Passband Frequency For Lowpass Filter (Hz)
Ws = 0.0012; % Stopband Frequency For Lowpass Filter (Hz)
Rp = 1; % Passband Ripple For Lowpass Filter (dB)
Rs = 50; % Stopband Ripple (Attenuation) For Lowpass Filter (dB)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Calculate Filter Order
[z,p,k] = ellip(n,Rp,Rs,Wp); % Calculate Filter
[sos,g] = zp2sos(z,p,k); % Second-Order-Section For Stability
% A_Filt = filtfilt(sos,g,A); % Filter Signal
figure
freqz(sos, 2^14, Fs) % Filter Bode Plot (Check Performance)
set(subplot(2,1,1), 'Xlim',[0 1])
set(subplot(2,1,2), 'Xlim',[0 1])
0 个评论
采纳的回答
Star Strider
2019-12-24
Specifying both passband and stopband frequencies (and without other arguments to the ellip function) means that you are designing a bandpass filter. I appreciate your quoting my code, however I also posted several examples of elliptical filters using bandpass filters.
For your filter, replace ‘Wp’ with:
Wp = [250 512]/Fn; % Passband Frequencies For Bandpass Filter (Hz)
and ‘Ws’ with:
Ws = [0.99 1.01]*Wp; % Stopband Frequencies For Bandpass Filter (Hz)
or define it yourself, similarly to the way I defined ‘Wp’ here. Note that for a bandpass filter, the stopbands must be outside the passbands.
16 个评论
Pallove Nautiyal
2022-5-18
please let me know the same @Danish khan if you got to know how to calculate stopband attenuation too.
更多回答(1 个)
Maria Amr
2020-11-3
Hello Star Strider,
I have a signal, that is a well log Acoustic Impedance log and I need to apply a Antialias filter in coarser samoling that means a bandpass filter.
Sample frequency is 6562 per kilometer (28000 sample/4.27km). I do need to identify cutt off frequencies correctly. I applied your passband code into my dataset but my proffessors says: apply an anti-alias filter that has a flat spectrum over the band of interest. Would you please direct me how I can identify cutoff frequencies? Appreciated!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!