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

2 views (last 30 days)
%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

Answers (1)

Kris Fedorenko
Kris Fedorenko on 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 Comment
Star Strider
Star Strider on 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');

Sign in to comment.

Categories

Find more on Biomedical Signal Processing in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!