フィルターのクリア

butterworth filter cutoff frequency calculation

15 ビュー (過去 30 日間)
masih
masih 2017 年 6 月 15 日
編集済み: Daniel M 2019 年 10 月 29 日
Hi All, I am not a electrical engineer so my question may sound stupid. Sorry about that. I have a some noisy data and I want to filter my data using a butterworth filter of order 2. I am having trouble finding the cutoff frequency for the filter design. How do I calculate cutoff frequency? I am sampling my data every 10 seconds. Thnanks.

採用された回答

Star Strider
Star Strider 2017 年 6 月 15 日
First, a Butterworth (or any) filter of order 2 is not likely to work as well as you want it to. You may find a Chebyshev Type II design more appropriate, especially with your extremely low sampling frequency.
Second, the best way to design a band-selective filter is to take the fft (link) of your signal to determine where the signal frequencies are and where the noise frequencies are. Use that information to design your filter. Note that if you have broadband noise, a frequency-selective filter will not eliminate all of the noise. You might want to eliminate baseline offset and low-frequency baseline variation as well, the reason I usually use a bandpass design.
The designfilt function can make filter design straightforward. Another acceptable way to design a Butterworth filter is this bandpass prototype:
Fs = 0.1; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
Wp = [0.002 0.010]/Fn; % Specify Bandpass Filter
Ws = [0.001 0.015]/Fn; % Stopband (normalised)
Rp = 10; % Passband Ripple (dB)
Rs = 30; % Stopband Ripple (dB)
[n,Wn] = buttord(Wp, Ws, Rp, Rs);
[z,p,k] = butter(n,Wn); % ZPK
[SOS,G] = zp2sos(z,p,k); % Convert To SOS for Stability
figure(2)
freqz(SOS, 2^16, Fs)
To design a Chebyshev Type II filter, replace buttord with cheb2ord and butter with cheby2. The arguments are slightly different, so keep that in mind. The rest of the code does not change.
  10 件のコメント
Star Strider
Star Strider 2019 年 10 月 29 日
@Ahmed Hassan — Post this as a new Question, and include more information.
I will delete this Comment in a few hours.
Daniel M
Daniel M 2019 年 10 月 29 日
編集済み: Daniel M 2019 年 10 月 29 日
Hi Star Strider, I'm trying to follow along, but when I run your code, I get the following error:
Warning: Usage of DATENUM with empty date character vectors or empty strings is
not supported.
Results may change in future versions.
> In datenum (line 95)
In untitled48 (line 2)
Error using plot
Vectors must be the same length.
Error in untitled (line 4)
plot(t, d)
t is empty because datenum() failed.
It seems to be an issue with xlsread on Linux, because
whos d s
Name Size Bytes Class Attributes
d 1999x3 47976 double
s 1x3 396 cell
On Windows it works properly. So nevermind then, I'll just do it there.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital and Analog Filters についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by