Effacer les filtres
Effacer les filtres

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

10 vues (au cours des 30 derniers jours)
afef
afef le 10 Mar 2017
Commenté : Star Strider le 24 Mar 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

Réponse acceptée

Star Strider
Star Strider le 10 Mar 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 commentaires
afef
afef le 24 Mar 2017
ok thanks.
Star Strider
Star Strider le 24 Mar 2017
My pleasure.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur EEG/MEG/ECoG dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by