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 (최근 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

답변 (1개)

Kris Fedorenko
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');
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
Star Strider
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 CenterFile Exchange에서 Biomedical Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by