|
输入: EEG_file: EEG Signal File welch_len: the length you want to welch seg_len: length of each segment Fs: sampling rate |
|
输出: Wel_psd: the Welch estimate of PSD(1) Initialization: over_len = seg_len/2;//Length of overlap between the successive segments(2) Data are read from EEG_file and stored into the arrary welch[N];(3) Calculate how many segments:N_segs.(4) for index in range (0, seg_len)(5) Create Hamming window win[一世];(6)你+ = Win [index] * win [index]; //计算累计值你;(7) index++;(8) end for(9) for seg_start in range (1, x_len-seg_len + 1)(10) seg_end = seg_start + seg_len −1; //seg_start and seg_end is start point and end point of each data segment, respectively.(11) apply Hamming window to the data of welch [N]在[seg_start,seg_end]之间;(12) Do FFT for windowed data. The result is stored in variable fft_x;(13) Calculating the square of the amplitude of the fft_x. The result is stored in variable pgram;(14) Summate power spectra Pxy + = pgram;(15) start_seg + = seg_len-overlap;(16) end for(17) Wel_psd = Pxy/(N_ffts×fs× 你); |
|