Thread Subject: pwelch PSD estimator syntax, please someone?

Subject: pwelch PSD estimator syntax, please someone?

From: Dutchice@gmail.com

Date: 25 Oct, 2007 23:36:37

Message: 1 of 3

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

Subject: pwelch PSD estimator syntax, please someone?

From: Honglei Chen

Date: 26 Oct, 2007 22:23:08

Message: 2 of 3

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@gmail.com> wrote in message
news:1193355397.539932.8230@57g2000hsv.googlegroups.com...
> 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
>


Subject: pwelch PSD estimator syntax, please someone?

From: ammal

Date: 15 Nov, 2007 18:50:36

Message: 3 of 3

 Hi ,
I am wondering if you could help me to estimate PSD from a
discrete series that represents measurements versus Depth.
after constructing PSD, i need to estimate Hurst Exponent
by plotting PSD versus frequency on a log-log plot and get
the slope.

The data looks like X(depth)= .1, .2,.......,
and X-axis values look like =0, .5, 1,......,100

your fast response is highly appreciated.

Ammal


Dutchice@gmail.com wrote in message
<1193355397.539932.8230@57g2000hsv.googlegroups.com>...
> 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
>

Tags for this Thread

Everyone's Tags:

psd

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
psd Ned Gulley 15 Nov, 2007 18:15:55
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com