필터 지우기
필터 지우기

Low-pass filter at 200Hz with a 2khz sampling rate?

조회 수: 4 (최근 30일)
Greydon Gilmore
Greydon Gilmore 2017년 1월 26일
댓글: Star Strider 2017년 1월 26일
Hi there,
I have ECoG data and need to only look at frequencies from 1-200Hz. I would like to use a band-pass filter to achieve this but I am having a hard time understanding how to calculate the coefficients and the number of taps. I would like to use a least-squares linear phase FIR filter design. I sampled a 2khz.
  댓글 수: 1
Greydon Gilmore
Greydon Gilmore 2017년 1월 26일
This text file has multiple channels, I would only need one channel to be filtered, in this instance I would like channel #7. In the textfile it is the 10th column.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2017년 1월 26일
Your design seems unnecessarily complicated to me.
I would use something like this:
Fs = 44100; % Sampling frequency
fcuts = [10 20 20E+3 21E+3]; % Frequency Vector (Hz)
mags = [0 1 0]; % Magnitude (Defines Passbands & Stopbands)
devs = [0.05 0.01 0.05]; % Allowable Deviations
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs);
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale');
figure(1)
freqz(hh, 1, 2^14, Fs)
Use the correct sampling frequency (as ‘Fs’) and bandstop and bandpass frequencies (in ‘fcuts’) for your signal.
See the documentation for kaiserord for details. The kaiserord function provides the normalised frequencies for the fir1 function.
  댓글 수: 3
John BG
John BG 2017년 1월 26일
편집: John BG 2017년 1월 26일
To Greydon;
1.
try Low pass filter, not BPF
2.
could you supply a sample of the sampled signal in a file attached to your question?
To Star Strider;
may be you would like to consider changing Fs to 2kHz, oversampling without having access to the original signal may distort rather than increase accuracy.
Star Strider
Star Strider 2017년 1월 26일
@Greydon Gilmore —
I didn’t see ‘Example File.txt’ earlier.
See if this does what you want:
fidi = fopen('Example File.txt','rt');
D = textscan(fidi, ['%*s%s' repmat('%f',1,11) '%*s'], 'CollectOutput',1);
t = datenum(D{1}, 'HH:MM:SS.FFF');
t = (t-t(1))*24*60*60; % Time Vector (sec)
Ts = mean(diff(t)); % Sampling Time (sec)
Fs = 1/Ts; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
DesiredChannel = 8; % This Should Be Channel #7
s = D{2}(:,DesiredChannel);
fcuts = [0.2 1.5 195 205]; % Frequency Vector (Hz)
mags = [0 1 0]; % Magnitude (Defines Passbands & Stopbands)
devs = [0.05 0.01 0.05]; % Allowable Deviations
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs);
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale');
figure(1)
freqz(hh, 1, 2^14, Fs)
sfilt = filtfilt(hh, 1, s); % Filter Signal
figure(2)
subplot(2,1,1)
plot(t, s)
grid
title('Raw Signal')
subplot(2,1,2)
plot(t, sfilt)
grid
title('Filtered Signal')
The filter (passband depicted in figure(1)) appears to do what you want. I don’t see much difference in the filtered signal, other than the elimination of the d-c component, but the filter appears to work correctly.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Digital and Analog Filters에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by