<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950</link>
    <title>MATLAB Central Newsreader - PSD and sptool</title>
    <description>Feed for thread: PSD and sptool</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>Sat, 04 Aug 2007 13:39:46 -0400</pubDate>
      <title>PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386285</link>
      <author>Vincenzo Manzoni</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
I am working with sptool for analyze the PSD (Power Spectral&lt;br&gt;
Density) of signals.&lt;br&gt;
&lt;br&gt;
Now, I need to implement the code to do the analysis in&lt;br&gt;
automatic manner. &lt;br&gt;
&lt;br&gt;
This is the code (x contains the time serie):&lt;br&gt;
&lt;br&gt;
y = fft(y, 2048);&lt;br&gt;
Pyy = y * conj(y);&lt;br&gt;
&lt;br&gt;
Now, I have searched how to calculare normalization factor&lt;br&gt;
(to render plot of my Pyy the same of sptool), but I haven't&lt;br&gt;
found nothing.&lt;br&gt;
&lt;br&gt;
Could you help me?</description>
    </item>
    <item>
      <pubDate>Sun, 05 Aug 2007 10:40:28 -0400</pubDate>
      <title>Re: PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386339</link>
      <author> Greg Heath</author>
      <description>On Aug 4, 9:39 am, &quot;Vincenzo Manzoni&quot; &amp;lt;ervin...@tiscali.it&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am working with sptool for analyze the PSD (Power Spectral&lt;br&gt;
&amp;gt; Density) of signals.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now, I need to implement the code to do the analysis in&lt;br&gt;
&amp;gt; automatic manner.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This is the code (x contains the time serie):&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; y = fft(y, 2048);&lt;br&gt;
&amp;gt; Pyy = y * conj(y);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now, I have searched how to calculare normalization factor&lt;br&gt;
&amp;gt; (to render plot of my Pyy the same of sptool), but I haven't&lt;br&gt;
&amp;gt; found nothing.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Could you help me?&lt;br&gt;
&lt;br&gt;
Google Groups&lt;br&gt;
&lt;br&gt;
greg-heath power-spectrum-scaling&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Sun, 05 Aug 2007 11:35:21 -0400</pubDate>
      <title>Re: PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386343</link>
      <author>Vincenzo Manzoni</author>
      <description>&amp;gt; greg-heath power-spectrum-scaling&lt;br&gt;
&lt;br&gt;
In this link&lt;br&gt;
(&lt;a href=&quot;http://www.mathworks.com/support/tech-notes/1700/1702.html)&quot;&gt;http://www.mathworks.com/support/tech-notes/1700/1702.html)&lt;/a&gt;&lt;br&gt;
the magnitude of fft is scaled by NFFT, while you, in your&lt;br&gt;
post, scale the fft by sqrt(NFFT).&lt;br&gt;
&lt;br&gt;
What is the difference? Thanks you for your help...</description>
    </item>
    <item>
      <pubDate>Sun, 05 Aug 2007 12:32:50 -0400</pubDate>
      <title>Re: PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386344</link>
      <author>Vincenzo Manzoni</author>
      <description>Uhm Greg, another question: if I calculate the power of this&lt;br&gt;
signal&lt;br&gt;
&lt;br&gt;
Fs = 1024;  % Sample frequency: 1 kHz&lt;br&gt;
t=0:1/Fs:10;&lt;br&gt;
x = sin(2*pi*10*t); % Sin with frequency = 10 Hz&lt;br&gt;
&lt;br&gt;
with fft following the article which I was cited the post&lt;br&gt;
before, I obtain an armonic at 10 Hz with power 0.5... that&lt;br&gt;
is theoretically corret.&lt;br&gt;
&lt;br&gt;
If I calculate the power of signal with sptool, I obtain an&lt;br&gt;
armonic at 10 Hz with power 1.5625... which change if I&lt;br&gt;
change NFFT.&lt;br&gt;
&lt;br&gt;
I am extremely confused...</description>
    </item>
    <item>
      <pubDate>Sun, 05 Aug 2007 22:37:36 -0400</pubDate>
      <title>Re: PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386351</link>
      <author> Greg Heath</author>
      <description>On Aug 5, 7:35 am, &quot;Vincenzo Manzoni&quot; &amp;lt;ervin...@tiscali.it&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt;greg-heathpower-spectrum-scaling&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; In this link&lt;br&gt;
&amp;gt; (&lt;a href=&quot;http://www.mathworks.com/support/tech-notes/1700/1702.html)&quot;&gt;http://www.mathworks.com/support/tech-notes/1700/1702.html)&lt;/a&gt;&lt;br&gt;
&amp;gt; the magnitude of fft is scaled by NFFT, while you, in your&lt;br&gt;
&amp;gt; post, scale the fft by sqrt(NFFT).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; What is the difference? Thanks you for your help...&lt;br&gt;
&lt;br&gt;
The difference is my convention yields the relations&lt;br&gt;
&lt;br&gt;
Pxav  =  sum(PSD)/N   =  sumsqr(x)/N&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Sun, 05 Aug 2007 23:17:19 -0400</pubDate>
      <title>Re: PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386353</link>
      <author> Greg Heath</author>
      <description>On Aug 5, 8:32 am, &quot;Vincenzo Manzoni&quot; &amp;lt;ervin...@tiscali.it&amp;gt; wrote:&lt;br&gt;
&amp;gt; UhmGreg, another question: if I calculate thepowerof this&lt;br&gt;
&amp;gt; signal&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Fs = 1024;  % Sample frequency: 1 kHz&lt;br&gt;
&lt;br&gt;
UMM ... 1KHz = 1000Hz&lt;br&gt;
&lt;br&gt;
&amp;gt; t=0:1/Fs:10;&lt;br&gt;
&lt;br&gt;
dt = 1/Fs = 0.0009765625&lt;br&gt;
&lt;br&gt;
T = 10 + dt = 10.0009765625&lt;br&gt;
&lt;br&gt;
N = T/dt = 10*Fs+1 = 10241&lt;br&gt;
&lt;br&gt;
&amp;gt; x = sin(2*pi*10*t); % Sin with frequency = 10 Hz&lt;br&gt;
&lt;br&gt;
f0 = 10&lt;br&gt;
T0 = 1/f0 = 0.1&lt;br&gt;
&lt;br&gt;
T/T0 = 100.009765625&lt;br&gt;
&lt;br&gt;
&amp;gt; with fft following the article which I was cited the post&lt;br&gt;
&amp;gt; before, I obtain an armonic&lt;br&gt;
&lt;br&gt;
correction: a harmonic&lt;br&gt;
&lt;br&gt;
&amp;gt; at 10 Hz with power 0.5... that is theoretically corret.&lt;br&gt;
&lt;br&gt;
Show how you obtained that value.&lt;br&gt;
&lt;br&gt;
&amp;gt; If I calculate the power of signal with sptool, I obtain an&lt;br&gt;
&amp;gt; armonic (sic) at 10 Hz with power 1.5625... which change if I&lt;br&gt;
&amp;gt; change NFFT.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am extremely confused...&lt;br&gt;
&lt;br&gt;
There might be a difference in scaling conventions. However,&lt;br&gt;
unless we know exactly what you did and exactly what sptool does,&lt;br&gt;
we can't do anything but guess.&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Mon, 06 Aug 2007 10:30:26 -0400</pubDate>
      <title>Re: PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386394</link>
      <author>Vincenzo Manzoni</author>
      <description>&amp;gt;&amp;gt; at 10 Hz with power 0.5... that is theoretically corret.&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; Show how you obtained that value.&lt;br&gt;
&lt;br&gt;
I know the area below the power density spectrum is the&lt;br&gt;
signal variance. Then:&lt;br&gt;
&lt;br&gt;
Fs = 1024;&lt;br&gt;
t = 0:1/Fs:1;&lt;br&gt;
x = sin(2*pi*t*10);&lt;br&gt;
&lt;br&gt;
var(x) -&amp;gt; 0.5&lt;br&gt;
&lt;br&gt;
If I calculate the PSD with normalization of the article&lt;br&gt;
which I have cited, &lt;br&gt;
&lt;br&gt;
sum(mx(:)) -&amp;gt; 0.5&lt;br&gt;
&lt;br&gt;
My assumption is correct?&lt;br&gt;
&lt;br&gt;
&amp;gt; However,&lt;br&gt;
&amp;gt; unless we know exactly what you did and exactly what&lt;br&gt;
sptool does,&lt;br&gt;
&amp;gt; we can't do anything but guess.&lt;br&gt;
&lt;br&gt;
In sptool, I import the same signal and I create the&lt;br&gt;
spectrum with fft as choose (with the same number of sample&lt;br&gt;
I use in when calculate the PSD without sptool).</description>
    </item>
    <item>
      <pubDate>Mon, 06 Aug 2007 22:13:41 -0400</pubDate>
      <title>Re: PSD and sptool</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153950#386493</link>
      <author>Honglei Chen</author>
      <description>If your purpose is to obtain an estimate of PSD using periodogram, then I'll &lt;br&gt;
suggest to use pwelch or even better, the spectrum object instead.&lt;br&gt;
&lt;br&gt;
For example, according to your post, the PSD can be simply calculated as&lt;br&gt;
&lt;br&gt;
Hspec = spectrum.periodogram;                    % define psd estimator&lt;br&gt;
Hopts = psdopts(Hspec, y);                          % construct psd &lt;br&gt;
estimator options&lt;br&gt;
set(Hopts,'NFFT',2048);                              %  set NFFT&lt;br&gt;
Hpsd = psd(Hspec,y);                                   % calculate psd&lt;br&gt;
plot(Hpsd);                                                    % plot psd&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
The tech note 1702 is a very simple example of calculating power spectrum &lt;br&gt;
using FFT, it is not a power spectrum DENSITY.  If you do want a power &lt;br&gt;
spectrum, you can use spectrum object too. All you have to do is to replace &lt;br&gt;
psd function with msspectrum function, i.e.,&lt;br&gt;
&lt;br&gt;
Hpsd = msspectrum(Hspec,y);&lt;br&gt;
&lt;br&gt;
There are two demos that you may be interested in, one of them is a brief &lt;br&gt;
introduction of using spectrum object and the other is about how to measure &lt;br&gt;
the power of a given signal.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/spectralanalysisobjsdemo.html&quot;&gt;http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/spectralanalysisobjsdemo.html&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/deterministicsignalpower.html&quot;&gt;http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/deterministicsignalpower.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Hope this helps,&lt;br&gt;
&lt;br&gt;
Honglei&lt;br&gt;
&lt;br&gt;
&quot;Vincenzo Manzoni&quot; &amp;lt;ervincio@tiscali.it&amp;gt; wrote in message &lt;br&gt;
news:f91vj2$2td$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am working with sptool for analyze the PSD (Power Spectral&lt;br&gt;
&amp;gt; Density) of signals.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now, I need to implement the code to do the analysis in&lt;br&gt;
&amp;gt; automatic manner.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This is the code (x contains the time serie):&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; y = fft(y, 2048);&lt;br&gt;
&amp;gt; Pyy = y * conj(y);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now, I have searched how to calculare normalization factor&lt;br&gt;
&amp;gt; (to render plot of my Pyy the same of sptool), but I haven't&lt;br&gt;
&amp;gt; found nothing.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Could you help me?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; </description>
    </item>
  </channel>
</rss>

