Error in fir1 (line 115) Wind = chkwindow(Wind,L);

23 Ansichten (letzte 30 Tage)
afef
afef am 10 Mär. 2017
Kommentiert: Star Strider am 24 Mär. 2017
i'm trying to use low pass FIR filter for EEG siganl that i have downloded from http://physionet.org/physiobank/database/chbmit/ but i got this error message Error using fir1>chkwindow (line 290) The window length must be the same as the filter length.
Error in fir1 (line 115) Wind = chkwindow(Wind,L); my code is: load('C:\Users\del.dell-PC\Downloads\chb01_01_edfm.mat') x = plot(val(1,:)); Fs=200; t = linspace(0,1,Fs); fc = 32; Wn = (2/Fs)*fc; L =40; b = fir1(40,Wn,'low',hamming(L)); fvtool(b,1,'Fs',Fs) y = filter(b,1,x);
plot(t,x,t,y) xlim([0 0.1])
xlabel('Time (s)') ylabel('Amplitude') legend('Original Signal','Filtered Data')
how can i fix that and how can i define the downloded signal thank you

Akzeptierte Antwort

Star Strider
Star Strider am 10 Mär. 2017
In R2017a (and probably earlier versions), the hamming window is the default. You only need to specify it as:
Fs=200;
t = linspace(0,1,Fs);
fc = 32;
Wn = (2/Fs)*fc;
L =40;
b = fir1(40,Wn);
figure(1)
freqz(b, 1, 2^16, Fs)
I included the freqz call so you can see that it works. It is not necessary for the code, and can be deleted.
Remember to use the filtfilt function to do the actual filtering.
  22 Kommentare
afef
afef am 24 Mär. 2017
ok thanks.
Star Strider
Star Strider am 24 Mär. 2017
My pleasure.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu EEG/MEG/ECoG finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by