Azzera filtri
Azzera filtri

How can i design a correct lowpass filter with the Filter Design Assistant?

1 visualizzazione (ultimi 30 giorni)
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?

Risposte (1)

Star Strider
Star Strider il 9 Ago 2019
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.
If you have R2018a or later, you can also use the lowpass function to design your filter. For all of these filters (the ones I design here and the second output from the lowpass function), use filtfilt to filter your signal with it.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by