Re: pwelch PSD estimator syntax, please someone?
- From: "Honglei Chen" <hchen@xxxxxxxxxxxxx>
- Date: Fri, 26 Oct 2007 18:23:08 -0400
Hi Mario,
In general, if you use 8 segments to estimate the spectrum in a 1024 sample
data series without overlap, each segment's length is
P = 1024/8 = 128.
However, when you allow Welch's method to calculate the spectrum using
overlapped data segments, each segment can be longer. Essentially, with an
overlap of 50%, there will be 9 ½-length segments to divide the entire
series. Therefore, the length of each data segment, P, becomes
P = 1024/(9*0.5) = 227.
This also leads to the fact that the number of overlap points, M, is given
by 113 instead of 64.
So, as you observed, pwelch(x,[],[],[],4) is actually the same as
pwelch(x,227,113,25,4).
Hope this helps,
Honglei
<Dutchice@xxxxxxxxx> wrote in message
news:1193355397.539932.8230@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all!
I sometimes feel MATLAB Help documentation really comes examples
short! :(
My question is the following;
I know that the pwelch estimator syntax for a discrete time series
vector x is as follows:
[Pxx,f] = pwelch(x,window,noverlap,nfft,fs)
and that when written as:
[Pxx,f] = pwelch(x,[],[],[],fs)
MATLAB will let for:
window: hamming(P)
noverlap: M
nfft: N
fs: Fs
where the defaults are:
P: number of samples needed to cut the record sample length into 8
segments
M: number of samples overlapping between two adjacent segments in
order to overlap 50%
N: 256
fs: 1 (sampling rate in hertz)
For my case, vector x has the following characteristics:
Sample record lenght: 1024 samples
sampling rate: 4 Hz
Sample input type: Real-valued
So this means that with the following syntax:
[Pxx,f] = pwelch(x,[],[],[],4)
MATLAB should compute:
P = 1024/8 = 128
M = 128*0.5 = 64
N = 256
fs = 4
Now would someone be able to explain please, how come when plotting as
follows;
[Pxx1,f1] = pwelch(x,[],[],[],4)
[Pxx2,f2] = pwelch(x,hamming(128),64,256,4)
loglog(f1,Pxx1,'b',f2,Pxx2,'r')
or also;
pwelch(x,[],[],[],4)
figure
pwelch(x,hamming(128),64,256,4)
the two plots JUST don't fall on each other neatly as if there was
only one plot!? :|
Very very curiously enough they do match perfect, one on other when;
[Pxx1,f1] = pwelch(x,[],[],[],4)
[Pxx2,f2] = pwelch(x,hamming(227),113,256,4)
loglog(f1,Pxx1,'b',f2,Pxx2,'r')
Can someone please explain why? (scaling of the two Pxx1 & Pxx2 to
match the variance of x didn't and shouldn't either make any
difference)
Download link for vector x is here:
http://rapidshare.com/files/65194703/OceanWaveData.dat.html
Cheers,
Mario
.
- References:
- pwelch PSD estimator syntax, please someone?
- From: Dutchice
- pwelch PSD estimator syntax, please someone?
- Prev by Date: Re: Serial Object: Time for data transmission
- Next by Date: Re: finding the m file name
- Previous by thread: pwelch PSD estimator syntax, please someone?
- Next by thread: A special kind of 3D graph in Matlab. Help!
- Index(es):
Relevant Pages
|