how to design a filter
Show older comments
please help to design a filter
Answers (1)
Star Strider
on 7 Nov 2019
Here is one for a bandstop filter:
Fs = 2250; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [59 61]/Fn; % Stopband Frequency (Normalised)
Ws = [58 62]/Fn; % Passband Frequency (Normalised)
Rp = 1; % Passband Ripple
Rs = 60; % Passband Ripple (Attenuation)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Elliptic Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp,'stop'); % Elliptic Filter Design: Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^18, Fs) % Filter Bode Plot
set(subplot(2,1,1), 'XLim',[0 100]) % Restrict Frequency Axis If Necessary To See Detail
set(subplot(2,1,2), 'XLim',[0 100]) % Restrict Frequency Axis If Necessary To See Detail
% signal_filt = filtfilt(sos, g, signal); % Filter Signal
Make appropriate changes to use it with your signals.
Categories
Find more on Digital Filter Analysis 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!