In some applications that i am using, i need only the limit of 200Hz. That's why i am confused.
How can i design a correct lowpass filter with the Filter Design Assistant?
1 次查看(过去 30 天)
显示 更早的评论
Hi! I try to design a simple lowpass filter to keep only the frequencys below 200Hz.
d1 = designfilt('lowpassiir', 'PassbandFrequency', XXX, 'StopbandFrequency', XXX, 'PassbandRipple', XXX, 'StopbandAttenuation', XXX, 'SampleRate', 1000);
My sampling ratio is 1000.
What should be my inputs at:
-PassbandFrequency
-StopbandFrequency
-StopbandAttenuation
-PassbandRipple
I only want to keep the 0-200Hz.
Any instructions?
回答(1 个)
Star Strider
2019-8-9
It is actually straightforward to design your filter using the various functions:
Fs = 1000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = 200/Fn; % Passband Normalised
Ws = 250/Fn; % Stopband Normalised
Rp = 1; % Passband Ripple (Irrelevant in Butterworth)
Rs = 50; % Stopband Attenuation
[n,Wn] = buttord(Wp,Ws,Rp,Rs); % Order Calculation
[z,p,k] = butter(n,Wn); % Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^16, Fs) % Filter Bode Plot
I prefer elliptical filters that here would be designed as:
Fs = 1000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = 200/Fn; % Passband Normalised
Ws = 210/Fn; % Stopband Normalised
Rp = 1; % Passband Ripple (Irrelevant in Butterworth)
Rs = 50; % Stopband Attenuation
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp); % Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^16, Fs) % Filter Bode Plot
Elliptic discrete filters are much more computationally efficient than other designs.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!