How can i filter an EEG signal?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aparna Gupta
le 8 Juil 2017
Modifié(e) : Walter Roberson
le 24 Oct 2017
I have generated an EEG signal in MATLAB.Then in have added random noise to it,n then filtered it using the code as under.But i am getting an error.Can anyone help me to remove it ?
fs = 512
T = 1/fs;
N =length(EEGsig); ls = size(EEGsig);
tx =[0:length(EEGsig)-1]/fs;
fx = fs*(0:N/2-1)/N;
x= EEGsig;
sd = 0.1;
normal_noise = sd*randn(1, N);
noisy_EEGsig = x + normal_noise;
figure();
subplot(4,1,1);
grid on;
plot(tx, x);
xlabel('Time [s]');
ylabel('Amplitude');
title('Original signal');
subplot(4,1,2);
grid on;
plot(tx,normal_noise);
xlabel('Time [s]');
ylabel('Amplitude');
title('Noise');
subplot(4,1,3);
grid on;
plot(tx, noisy_EEGsig);
xlabel('Time [s]');
ylabel('Amplitude');
title('Original signal + Noise');
subplot(4,1,4);
d = designfilt('bandstopiir', 'FilterOrder', 2, 'HalfPowerFrequency1', 59, 'HalfPowerFrequency2', 61, 'DesignMethod', 'butter', 'SampleRate', fs);
fvtool(d,'fs',fs)
buttLoop = filtfilt(d, noisy_EEGsig);
plot(t, noisy_EEGsig,t,buttLoop)
ylabel('Voltage (V)')
xlabel('Time (s)')
title('filtered signal')
legend('Unfiltered','Filtered')
grid
The error i am getting is :
"Undefined function 'designfilt' for input arguments of type 'char'."
1 commentaire
aida
le 24 Oct 2017
your error in this line (9.noisy_EEGsig = x + normal_noise) and error because of sum different matrix with each other and the correct on is noisy_EEGsig = tx + normal_noise
Réponse acceptée
Star Strider
le 8 Juil 2017
Three possibilities:
1. You do not have the Signal Processing Toolbox (that has the designfilt function);
2. Your MATLAB and Signal Processing Toolbox versions are prior to R2014a when designfilt was added;
3. You have an appropriate version of the Signal Processing Toolbox, and need to run these commands (from your Command Window or a script) to restore the correct paths:
restoredefaultpath
rehash toolboxcache
Note that no frequency-selective filter will completely eliminate broad-band noise, and a bandstop filter of the sort you want to implement will only eliminate 60 Hz mains frequency noise.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Bartlett dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!