illegal121
Member level 2
Hello Friends..! I am student and working on my BCI project.. I have to process EEG data and interpret the changes in EEG signal... I have signals in the .txt format.. I am passing my signal from a lowpass/bandpass filter and then taking burg spectrum for PSD .. My question is that what I am doing is the correct way ..? I just want to see the changes in my EEG signal in frequency domain ... below is my code... And If I take FFT of my signal or take power spectral estimation ( burgs or welch as in my code) so , these both gives me same result ...?still cant understand the difference between burg spectrum and FFT:sad: And sampling frequecy is same as the inverse of sampling rate of my ADC conversion time .....?
function Hd = bandpass %BANDPASS Returns a discrete-time filter object
% % M-File generated by MATLAB® 7.0 and the Signal Processing Toolbox 6.2. % % Generated on: 29-Jun-2011 14:12:51 %
% FIR Window Bandpass filter designed using the FIR1 function.
% All frequency values are in Hz.
Fs = 1000; % Sampling Frequency
N = 8; % Order
Fc1 = 8; % First Cutoff Frequency
Fc2 = 14; % Second Cutoff Frequency
flag = 'noscale'; % Sampling Flag
% Create the window vector for the design algorithm.
win = hamming(N+1);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, [Fc1 Fc2]/(Fs/2), 'bandpass', win, flag);
Hd = dfilt.dffir(b);
data=[] % my signal in txt format 512 samples
figure;
C=filter(Hd,data)
plot(C)
figure;
Hburg = spectrum.burg(14); % 14th order model
psd(Hburg,data(1:512),'Fs',1000,'NFFT',512)*
function Hd = bandpass %BANDPASS Returns a discrete-time filter object
% % M-File generated by MATLAB® 7.0 and the Signal Processing Toolbox 6.2. % % Generated on: 29-Jun-2011 14:12:51 %
% FIR Window Bandpass filter designed using the FIR1 function.
% All frequency values are in Hz.
Fs = 1000; % Sampling Frequency
N = 8; % Order
Fc1 = 8; % First Cutoff Frequency
Fc2 = 14; % Second Cutoff Frequency
flag = 'noscale'; % Sampling Flag
% Create the window vector for the design algorithm.
win = hamming(N+1);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, [Fc1 Fc2]/(Fs/2), 'bandpass', win, flag);
Hd = dfilt.dffir(b);
data=[] % my signal in txt format 512 samples
figure;
C=filter(Hd,data)
plot(C)
figure;
Hburg = spectrum.burg(14); % 14th order model
psd(Hburg,data(1:512),'Fs',1000,'NFFT',512)*