Filter design parameter: radian/sec or 1/sec?
3 views (last 30 days)
Show older comments
Dear All, I am confused with some fundamental problem in Matlab. Sorry to as such a basic problem.
Signal: x[n]= cos(2*pi*(n-1)*Ts)+2*cos(2pi*f*(n-1)*Ts), n=1,2,3,...,1000 and Ts=0.002
I want to design filter to get the first term and the second term respestively with 16-order filter. But I am not sure the passband should be
"1Hz, f Hz" or "2pi, 2pi*f"
when I call the filter function such as butter, cheby1, cheby2, ellip in IIR or in FIR. May you so kind give me an example?
0 Comments
Accepted Answer
Star Strider
on 4 Jun 2017
The passbands and stopbands for the Signal Processing Toolbox filter functions are actually normalised to the closed interval [0, pi] radians. It is calculated as the passband and stopband frequency in Hz divided by the Nyquist frequency.
Example for frequency calculations for the filters your signal:
Ts = 0.002; % Sampling Interval (seconds)
Fs = 1/Ts; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
Note that the highest frequency you can design in your filter is the Nyquist frequency, here 250 Hz.
An example of a Chebyshev Type II filter design for filtering an EKG signal is here:
Fs = 250; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = [1.0 100]/Fn; % Passband Frequencies (Normalised)
Ws = [0.5 101]/Fn; % Stopband Frequencies (Normalised)
Rp = 10; % Passband Ripple (dB)
Rs = 50; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws); % Filter Design
[sosbp,gbp] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(3)
freqz(sosbp, 2^17, Fs)
EKG_filt = filtfilt(sosbp, gbp, EKG_original); % Filter EKG Signal
The filter passband goes from 1 Hz to 100 Hz.
0 Comments
More Answers (0)
See Also
Categories
Find more on 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!