How to do FFT Analysis to EEG signals Using Matlab
古いコメントを表示
I'm looking for FFT analysis to EEG or ECG signals in MATLAB.
I have tested some codes. Nevertheless I don't know how to obtain a normalized result.
I have read in the documentation that I need to normalize by sample length and sampling rate as well as the window energy, but I don't know if MATLAB functions applied a normalization before...
This is my code for ECG analysis of RR intervals:
{Hwelch=spectrum.welch('Hann',winwidth,50);
psdperiodo = psd(Hwelch,RR,'nfft',nfft/2,'Fs',freqinterpol,'SpectrumType','onesided');
PSD = psdperiodo.data /(size(RR,1)*(freqinterpol * size(psdperiodo.data,1)));
% find the indexes corresponding to the VLF, LF, and HF bands
iVLF= find((psdperiodo.frequencies>VLFmin) & (psdperiodo.frequencies<=VLFmax));
iLF = find((psdperiodo.frequencies>LFmin) & (psdperiodo.frequencies<=LFmax));
iHF = find((psdperiodo.frequencies>HFmin) & (psdperiodo.frequencies<=HFmax));
% calculate raw areas (power under curve), within the freq bands (ms^2)
aVLF=trapz(psdperiodo.frequencies(iVLF),PSD(iVLF))*10^6;
aLF=trapz(psdperiodo.frequencies(iLF),PSD(iLF))*10^6;
aHF=trapz(psdperiodo.frequencies(iHF),PSD(iHF))*10^6;
}
採用された回答
その他の回答 (5 件)
Wayne King
2012 年 11 月 16 日
You should format your code when you post. Since you are using spectrum.welch, you should use the avgpower() method to calculate the average power in specific frequency intervals.
For example:
Fs = 1000;
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t)+randn(size(t));
hs = spectrum.welch;
hs.SegmentLength = 200;
psdest = psd(hs,x,'Fs',Fs);
Now to determine the average power in an interval around 100 Hz and compare that to the total power over the Nyquist range.
avgpower(psdest,[90 110])/avgpower(psdest)
Wayne King
2012 年 11 月 16 日
0 投票
The nonparametric PSD estimates in MATLAB like the periodogram and Welch estimator already "normalize" the result to create the PSD estimate. For example, in the periodogram with the default rectangular window, the magnitude squared DFT values are "normalized" by dividing by the length of the input and the sampling rate as you state in your post, although for a one-sided PSD estimate, the frequencies other than 0 and the Nyquist are multiplied by 2 for energy conversion. You can see this worked out explicitly here:
In the case of the Welch estimate, it's more complicated since you have to divide also by the energy of the window.
Ouamar ferhani
2012 年 11 月 17 日
Ouamar ferhani
2012 年 11 月 18 日
編集済み: Ouamar ferhani
2012 年 11 月 18 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Bartlett についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!