<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158339</link>
    <title>MATLAB Central Newsreader - pwelch PSD estimator syntax, please someone?</title>
    <description>Feed for thread: pwelch PSD estimator syntax, please someone?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 25 Oct 2007 23:36:37 -0400</pubDate>
      <title>pwelch PSD estimator syntax, please someone?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158339#398454</link>
      <author> Dutchice@gmail.com</author>
      <description>Hi all!&lt;br&gt;
&lt;br&gt;
I sometimes feel MATLAB Help documentation really comes examples&lt;br&gt;
short! :(&lt;br&gt;
&lt;br&gt;
My question is the following;&lt;br&gt;
I know that the pwelch estimator syntax for a discrete time series&lt;br&gt;
vector x is as follows:&lt;br&gt;
[Pxx,f] = pwelch(x,window,noverlap,nfft,fs)&lt;br&gt;
and that when written as:&lt;br&gt;
[Pxx,f] = pwelch(x,[],[],[],fs)&lt;br&gt;
MATLAB will let for:&lt;br&gt;
window: hamming(P)&lt;br&gt;
noverlap: M&lt;br&gt;
nfft: N&lt;br&gt;
fs: Fs&lt;br&gt;
where the defaults are:&lt;br&gt;
P: number of samples needed to cut the record sample length into 8&lt;br&gt;
segments&lt;br&gt;
M: number of samples overlapping between two adjacent segments in&lt;br&gt;
order to overlap 50%&lt;br&gt;
N: 256&lt;br&gt;
fs: 1 (sampling rate in hertz)&lt;br&gt;
&lt;br&gt;
For my case, vector x has the following characteristics:&lt;br&gt;
Sample record lenght: 1024 samples&lt;br&gt;
sampling rate: 4 Hz&lt;br&gt;
Sample input type: Real-valued&lt;br&gt;
&lt;br&gt;
So this means that with the following syntax:&lt;br&gt;
[Pxx,f] = pwelch(x,[],[],[],4)&lt;br&gt;
MATLAB should compute:&lt;br&gt;
P = 1024/8 = 128&lt;br&gt;
M = 128*0.5 = 64&lt;br&gt;
N = 256&lt;br&gt;
fs = 4&lt;br&gt;
&lt;br&gt;
Now would someone be able to explain please, how come when plotting as&lt;br&gt;
follows;&lt;br&gt;
[Pxx1,f1] = pwelch(x,[],[],[],4)&lt;br&gt;
[Pxx2,f2] = pwelch(x,hamming(128),64,256,4)&lt;br&gt;
loglog(f1,Pxx1,'b',f2,Pxx2,'r')&lt;br&gt;
&lt;br&gt;
or also;&lt;br&gt;
&lt;br&gt;
pwelch(x,[],[],[],4)&lt;br&gt;
figure&lt;br&gt;
pwelch(x,hamming(128),64,256,4)&lt;br&gt;
&lt;br&gt;
the two plots JUST don't fall on each other neatly as if there was&lt;br&gt;
only one plot!? :|&lt;br&gt;
Very very curiously enough they do match perfect, one on other when;&lt;br&gt;
&lt;br&gt;
[Pxx1,f1] = pwelch(x,[],[],[],4)&lt;br&gt;
[Pxx2,f2] = pwelch(x,hamming(227),113,256,4)&lt;br&gt;
loglog(f1,Pxx1,'b',f2,Pxx2,'r')&lt;br&gt;
&lt;br&gt;
Can someone please explain why? (scaling of the two Pxx1 &amp; Pxx2 to&lt;br&gt;
match the variance of x didn't and shouldn't either make any&lt;br&gt;
difference)&lt;br&gt;
Download link for vector x is here: &lt;a href=&quot;http://rapidshare.com/files/65194703/OceanWaveData.dat.html&quot;&gt;http://rapidshare.com/files/65194703/OceanWaveData.dat.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Cheers,&lt;br&gt;
&lt;br&gt;
Mario</description>
    </item>
    <item>
      <pubDate>Fri, 26 Oct 2007 22:23:08 -0400</pubDate>
      <title>Re: pwelch PSD estimator syntax, please someone?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158339#398602</link>
      <author>Honglei Chen</author>
      <description>Hi Mario,&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
In general, if you use 8 segments to estimate the spectrum in a 1024 sample &lt;br&gt;
data series without overlap, each segment's length is&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
P = 1024/8 = 128.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
However, when you allow Welch's method to calculate the spectrum using &lt;br&gt;
overlapped data segments, each segment can be longer.  Essentially, with an &lt;br&gt;
overlap of 50%, there will be 9 &#189;-length segments to divide the entire &lt;br&gt;
series. Therefore, the length of each data segment, P, becomes&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
P = 1024/(9*0.5) = 227.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
This also leads to the fact that the number of overlap points, M, is given &lt;br&gt;
by 113 instead of 64.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
So, as you observed, pwelch(x,[],[],[],4) is actually the same as &lt;br&gt;
pwelch(x,227,113,25,4).&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Hope this helps,&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Honglei&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;lt;Dutchice@gmail.com&amp;gt; wrote in message &lt;br&gt;
news:1193355397.539932.8230@57g2000hsv.googlegroups.com...&lt;br&gt;
&amp;gt; Hi all!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I sometimes feel MATLAB Help documentation really comes examples&lt;br&gt;
&amp;gt; short! :(&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; My question is the following;&lt;br&gt;
&amp;gt; I know that the pwelch estimator syntax for a discrete time series&lt;br&gt;
&amp;gt; vector x is as follows:&lt;br&gt;
&amp;gt; [Pxx,f] = pwelch(x,window,noverlap,nfft,fs)&lt;br&gt;
&amp;gt; and that when written as:&lt;br&gt;
&amp;gt; [Pxx,f] = pwelch(x,[],[],[],fs)&lt;br&gt;
&amp;gt; MATLAB will let for:&lt;br&gt;
&amp;gt; window: hamming(P)&lt;br&gt;
&amp;gt; noverlap: M&lt;br&gt;
&amp;gt; nfft: N&lt;br&gt;
&amp;gt; fs: Fs&lt;br&gt;
&amp;gt; where the defaults are:&lt;br&gt;
&amp;gt; P: number of samples needed to cut the record sample length into 8&lt;br&gt;
&amp;gt; segments&lt;br&gt;
&amp;gt; M: number of samples overlapping between two adjacent segments in&lt;br&gt;
&amp;gt; order to overlap 50%&lt;br&gt;
&amp;gt; N: 256&lt;br&gt;
&amp;gt; fs: 1 (sampling rate in hertz)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; For my case, vector x has the following characteristics:&lt;br&gt;
&amp;gt; Sample record lenght: 1024 samples&lt;br&gt;
&amp;gt; sampling rate: 4 Hz&lt;br&gt;
&amp;gt; Sample input type: Real-valued&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So this means that with the following syntax:&lt;br&gt;
&amp;gt; [Pxx,f] = pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; MATLAB should compute:&lt;br&gt;
&amp;gt; P = 1024/8 = 128&lt;br&gt;
&amp;gt; M = 128*0.5 = 64&lt;br&gt;
&amp;gt; N = 256&lt;br&gt;
&amp;gt; fs = 4&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now would someone be able to explain please, how come when plotting as&lt;br&gt;
&amp;gt; follows;&lt;br&gt;
&amp;gt; [Pxx1,f1] = pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; [Pxx2,f2] = pwelch(x,hamming(128),64,256,4)&lt;br&gt;
&amp;gt; loglog(f1,Pxx1,'b',f2,Pxx2,'r')&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; or also;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; figure&lt;br&gt;
&amp;gt; pwelch(x,hamming(128),64,256,4)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; the two plots JUST don't fall on each other neatly as if there was&lt;br&gt;
&amp;gt; only one plot!? :|&lt;br&gt;
&amp;gt; Very very curiously enough they do match perfect, one on other when;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; [Pxx1,f1] = pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; [Pxx2,f2] = pwelch(x,hamming(227),113,256,4)&lt;br&gt;
&amp;gt; loglog(f1,Pxx1,'b',f2,Pxx2,'r')&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Can someone please explain why? (scaling of the two Pxx1 &amp; Pxx2 to&lt;br&gt;
&amp;gt; match the variance of x didn't and shouldn't either make any&lt;br&gt;
&amp;gt; difference)&lt;br&gt;
&amp;gt; Download link for vector x is here: &lt;br&gt;
&amp;gt; &lt;a href=&quot;http://rapidshare.com/files/65194703/OceanWaveData.dat.html&quot;&gt;http://rapidshare.com/files/65194703/OceanWaveData.dat.html&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Cheers,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Mario&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Thu, 15 Nov 2007 18:50:36 -0500</pubDate>
      <title>Re: pwelch PSD estimator syntax, please someone?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158339#401547</link>
      <author>ammal</author>
      <description>&amp;nbsp;Hi ,&lt;br&gt;
I am wondering if you could help me to estimate PSD from a &lt;br&gt;
discrete series that represents measurements versus Depth. &lt;br&gt;
after constructing PSD, i need to estimate Hurst Exponent &lt;br&gt;
by plotting PSD versus frequency on a log-log plot and get &lt;br&gt;
the slope.&lt;br&gt;
&lt;br&gt;
The data looks like X(depth)= .1, .2,......., &lt;br&gt;
and X-axis values look like =0, .5, 1,......,100&lt;br&gt;
&lt;br&gt;
your fast response is highly appreciated.&lt;br&gt;
&lt;br&gt;
Ammal     &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Dutchice@gmail.com wrote in message &lt;br&gt;
&amp;lt;1193355397.539932.8230@57g2000hsv.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I sometimes feel MATLAB Help documentation really comes &lt;br&gt;
examples&lt;br&gt;
&amp;gt; short! :(&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; My question is the following;&lt;br&gt;
&amp;gt; I know that the pwelch estimator syntax for a discrete &lt;br&gt;
time series&lt;br&gt;
&amp;gt; vector x is as follows:&lt;br&gt;
&amp;gt; [Pxx,f] = pwelch(x,window,noverlap,nfft,fs)&lt;br&gt;
&amp;gt; and that when written as:&lt;br&gt;
&amp;gt; [Pxx,f] = pwelch(x,[],[],[],fs)&lt;br&gt;
&amp;gt; MATLAB will let for:&lt;br&gt;
&amp;gt; window: hamming(P)&lt;br&gt;
&amp;gt; noverlap: M&lt;br&gt;
&amp;gt; nfft: N&lt;br&gt;
&amp;gt; fs: Fs&lt;br&gt;
&amp;gt; where the defaults are:&lt;br&gt;
&amp;gt; P: number of samples needed to cut the record sample &lt;br&gt;
length into 8&lt;br&gt;
&amp;gt; segments&lt;br&gt;
&amp;gt; M: number of samples overlapping between two adjacent &lt;br&gt;
segments in&lt;br&gt;
&amp;gt; order to overlap 50%&lt;br&gt;
&amp;gt; N: 256&lt;br&gt;
&amp;gt; fs: 1 (sampling rate in hertz)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; For my case, vector x has the following characteristics:&lt;br&gt;
&amp;gt; Sample record lenght: 1024 samples&lt;br&gt;
&amp;gt; sampling rate: 4 Hz&lt;br&gt;
&amp;gt; Sample input type: Real-valued&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So this means that with the following syntax:&lt;br&gt;
&amp;gt; [Pxx,f] = pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; MATLAB should compute:&lt;br&gt;
&amp;gt; P = 1024/8 = 128&lt;br&gt;
&amp;gt; M = 128*0.5 = 64&lt;br&gt;
&amp;gt; N = 256&lt;br&gt;
&amp;gt; fs = 4&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Now would someone be able to explain please, how come &lt;br&gt;
when plotting as&lt;br&gt;
&amp;gt; follows;&lt;br&gt;
&amp;gt; [Pxx1,f1] = pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; [Pxx2,f2] = pwelch(x,hamming(128),64,256,4)&lt;br&gt;
&amp;gt; loglog(f1,Pxx1,'b',f2,Pxx2,'r')&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; or also;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; figure&lt;br&gt;
&amp;gt; pwelch(x,hamming(128),64,256,4)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; the two plots JUST don't fall on each other neatly as if &lt;br&gt;
there was&lt;br&gt;
&amp;gt; only one plot!? :|&lt;br&gt;
&amp;gt; Very very curiously enough they do match perfect, one on &lt;br&gt;
other when;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [Pxx1,f1] = pwelch(x,[],[],[],4)&lt;br&gt;
&amp;gt; [Pxx2,f2] = pwelch(x,hamming(227),113,256,4)&lt;br&gt;
&amp;gt; loglog(f1,Pxx1,'b',f2,Pxx2,'r')&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can someone please explain why? (scaling of the two Pxx1 &lt;br&gt;
&amp; Pxx2 to&lt;br&gt;
&amp;gt; match the variance of x didn't and shouldn't either make &lt;br&gt;
any&lt;br&gt;
&amp;gt; difference)&lt;br&gt;
&amp;gt; Download link for vector x is here: &lt;br&gt;
&lt;a href=&quot;http://rapidshare.com/files/65194703/OceanWaveData.dat.html&quot;&gt;http://rapidshare.com/files/65194703/OceanWaveData.dat.html&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Cheers,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Mario&lt;br&gt;
&amp;gt; </description>
    </item>
  </channel>
</rss>

