Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!57g2000hsv.googlegroups.com!not-for-mail
From:  Dutchice@gmail.com
Newsgroups: comp.soft-sys.matlab
Subject: pwelch PSD estimator syntax, please someone?
Date: Thu, 25 Oct 2007 23:36:37 -0000
Organization: http://groups.google.com
Lines: 66
Message-ID: <1193355397.539932.8230@57g2000hsv.googlegroups.com>
NNTP-Posting-Host: 145.94.72.204
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1193355397 18054 127.0.0.1 (25 Oct 2007 23:36:37 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 25 Oct 2007 23:36:37 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: 57g2000hsv.googlegroups.com; posting-host=145.94.72.204;
Xref: news.mathworks.com comp.soft-sys.matlab:434681



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