how to implement a notch filter in the EEG signal after adding noise
5 views (last 30 days)
Show older comments
fs = 512
T = 1/fs;
N =length(EEGsig); ls = size(EEGsig);
tx =[0:length(EEGsig)-1]/fs;
fx = fs*(0:N/2-1)/N;
ax=1;
x= EEGsig;
fNoise = 50;
aNoise = 0.25;
noise= aNoise*x;
signalNoise= x + noise;
figure();
subplot(3,1,1);
plot(tx, x);
xlabel('Time [s]');
ylabel('Amplitude');
title('Original signal');
subplot(3,1,2);
plot(tx, noise);
xlabel('Time [s]');
ylabel('Amplitude');
title('Noise');
subplot(3,1,3);
plot(tx, signalNoise);
xlabel('Time [s]');
ylabel('Amplitude');
title('Original signal + Noise');
t=(0:fs-1)*T;
x=0.7*sin(2*pi*50*t)+sin(2*pi*120*t);
subplot(2,1,1);
plot(fs*t(1:50));x(1:50);
w0=50/(1000/2);bw=w0/60;
[b,a]=iirnotch(w0,bw);
y=filter(b,a,x);
ydft=(fft(y)xdft)=fft(x);
freq=0:fs/length(x)):500;
subplot(2,1,1)
plot(freq,abs(xdft(1:501))^2);
subplot(2,1,2);
plot(freq,abs(ydft(1:501))^2);
xlabel(‘Time[s]’);
ylabel(‘Amplitude’);
title(‘Filtered signal’);
I need to implement a notch filter in the following EEG signal after adding the noise after writing the following code i am not getting the desired results. kindly help me to filter it telling the ammendments in the code.
0 Comments
Answers (1)
See Also
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!