How to calculate passband and stopband coefficients for signal filtering?

조회 수: 107 (최근 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])

채택된 답변

Star Strider
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
Danish khan
Danish khan 2020년 5월 22일
Can you tell us a way on how to calculate maximum stopband attenuation?
Pallove Nautiyal
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
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!

카테고리

Help CenterFile Exchange에서 Frequency Transformations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by