|
"rams dhiga" wrote in message <j9p6rs$iau$1@newscl01ah.mathworks.com>...
> "Wayne King" wrote in message <j9oe6j$8ff$1@newscl01ah.mathworks.com>...
> > "rams dhiga" wrote in message <j9n5ue$d9s$1@newscl01ah.mathworks.com>...
> > > Can any one tell me how to perform welch power spectrum on the EEG data using moving
> > > windows in matlab?
> >
> > In the Signal Processing Toolbox, see
> >
> > pwelch
> >
> > or
> > spectrum.welch
>
> But I need to implement this with moving windows.Can you tell me how?
this is an example without specifying window
%Define a cosine of 200 Hz, add noise and view its spectral content using the Welch %algorithm.
Fs=1000;
t=0:1/Fs:.3;
x=cos(2*pi*t*200)+randn(size(t));
Hs=spectrum.welch;
psd(Hs,x,'Fs',Fs)
%%%%%%%%%%%%%%%%ù
this is another exemple by specifying length and kind window (hann window ) you can change the kind or the lengh or the noverlapping (noverlap must be < lengh of window)
Fs = 1000;
t = 0:1/Fs:.3;
x=cos(2*pi*t*200)+randn(size(t));
window=33;
noverlap=32;
nfft=4097;
h = spectrum.welch('Hann',window,100*noverlap/window);
hpsd = psd(h,x,'NFFT',nfft,'Fs',Fs);
Pw = hpsd.Data;
Fw = hpsd.Frequencies;
psd(h,x,'NFFT',nfft,'Fs',Fs)
|