Designing a higher order lowpass filter to avoid Gibbs phenomenon
6 views (last 30 days)
Show older comments
Dhanushka Palipana
on 12 May 2020
Commented: Star Strider
on 13 May 2020
Hello!
I'm designing a simple but higher order lowpass filter to get rid of the Gibbs Phenomenon. This is what I thought of. Am I correct? Is this a valid filter?
d = designfilt('lowpassiir', 'FilterOrder',20,... % Response type
'PassbandFrequency',400, ... % Frequency constraints
'MatchExactly','passband', ... % Design method options
'SampleRate',2000)
I want to keep it simple having only cutoff frequency and the order as variables. (I assumed 'Match exactly' should be 'passband' because I need the filter to depend on cutoff frequency. Is this not necessary?)
How should I compensate for the delay in this? Since it is an IIR filter, it's only a phase shift, am I right?
Thank you!!
0 Comments
Accepted Answer
Star Strider
on 13 May 2020
I could not get that code to work.
Try this:
Fs = 2000; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = 400/Fn; % Normalised Passband (Passband = 5 Hz To 40 Hz)
Ws = 450/Fn; % Normalised Stopband (Passband = 2 Hz To 45 Hz)
Rp = 1; % Passband Ripple/Attenuation
Rs = 60; % Stopband Ripple/Attenuation
[n,Wp] = ellipord(Wp, Ws, Rp, Rs); % Calculate Elliptic Filter Optimum Order
[z,p,k] = ellip(n, Rp, Rs, Wp,'low'); % Elliptic Filter
[sos,g] = zp2sos(z,p,k); % Second-Order-Section For Stability
figure
freqz(sos, 2^26, Fs)
To use it with filtfilt:
y_filtered = filtfilt(sos, g, y);
4 Comments
More Answers (0)
See Also
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!