I have a datafile contains data sets (size 200* 15) .how can I apply on all the data a lowpass butterworth filter of 2-order with cutoff fre 10 HZ

1 回表示 (過去 30 日間)
How can I call filter function like [b,a] = butter(n,Wn) or [b,a] = butter(n,Wn,ftype) for whole data file and collect them in another for further use.

採用された回答

David J. Mack
David J. Mack 2016 年 12 月 29 日
編集済み: David J. Mack 2016 年 12 月 29 日
Hey Rahul,
use FILTER with the coefficients created with BUTTER, e.g.:
%Assuming X is your 200x15 data matrix and fSInHz is the sampling rate of the data.
filtFCInHz = 10; %Cut-off frequency.
filtOrder = 2; %Order.
[b,a] = butter(filtOrder,filtFCInHz/(fSInHz/2)); %Normalize against Nyquist frequency.
Y = filter(b,a,X); %Y is the filtered 200x15 output.
If you want to apply zero-phase filtering (which is recommended for time series), use FILTFILT instead of FILTER.
Greetings, David
  4 件のコメント
Rahul Pandey
Rahul Pandey 2016 年 12 月 30 日
編集済み: Rahul Pandey 2016 年 12 月 30 日
what is the best way to find the sampling rate of data for using with filters like lowpass butterworth filter(two pass - forward and backward Zero-phase digital filtering) of 2-order with cutoff freq 10 HZ that u answered.
David J. Mack
David J. Mack 2017 年 1 月 11 日
Do you have a time vector for your data? If so, use:
fSInHz = mode(diff(t,[],1),1);
Assuming t is a 200xk column-oriented array with the time for each sample in seconds. If k==1 (uniform sampling rate) fSInHz is a scalar, if k==15 (different sampling rates for each column in X) it is a 1x15 row vector.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by