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 次查看(过去 30 天)
显示 更早的评论
%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
0 个评论
回答(1 个)
Kris Fedorenko
2017-8-8
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');
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 个评论
Star Strider
2017-8-8
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');
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 EEG/MEG/ECoG 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!