hi, i am trying to plot my eeg dataset with and without filter.The plots which i got after applying butterworth filter is in an amplified form.i am attchng image (with filter) and code for plotting eeg(without filter).pls help me

3 Ansichten (letzte 30 Tage)
%without filter
clc;
clear all;
Fs=256;
cd('E:\Thesis EEG\MIT_EEG_Database\P1');
ea=dir;
for i=3:5
ea(i).name
s=load(ea(i).name);
x=[s.val];
[r,c]=size(x);
for j=1:2
window=x(1,(j-1)*256+1:j*256);
figure;
plot(window);
end
end

Antworten (1)

Kris Fedorenko
Kris Fedorenko am 8 Aug. 2017
Hi Nirmal!
I do not have a lot of domain knowledge in this area, but based on the documentation page for the "butter" function , using the [z,p,k] syntax might be more numerically stable than using [a,b] syntax.
You should be able to use this syntax as follows:
[z,p,k] = butter(n, Wn);
[b,a] = zp2tf(z,p,k);
Y = filter(b1, a1, x');
I have reproduced your code and tried it on a few EEG data files from this database .
Using [z,p,k] syntax for the "butter" function results in filtered data of similar magnitudes as the original data, while using [a,b] syntax made filter data appear amplified. So I hope this helps!
Kris
  1 Kommentar
Star Strider
Star Strider am 8 Aug. 2017
Actually, converting to second-order-section representation is preferable:
[z,p,k] = butter(n, Wn);
[sos,g] = zp2sos(z,p,k);
Y = filtfilt(sos, g, x');

Melden Sie sich an, um zu kommentieren.

Kategorien

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by