comparison m-toolbox/html_help/help/ug/sigproc_psd.html @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
3
4 <html lang="en">
5 <head>
6 <meta name="generator" content=
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org">
8 <meta http-equiv="Content-Type" content=
9 "text/html; charset=us-ascii">
10
11 <title>Power spectral density estimates (LTPDA Toolbox)</title>
12 <link rel="stylesheet" href="docstyle.css" type="text/css">
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2">
14 <meta name="description" content=
15 "Presents an overview of the features, system requirements, and starting the toolbox.">
16 </head>
17
18 <body>
19 <a name="top_of_page" id="top_of_page"></a>
20
21 <p style="font-size:1px;">&nbsp;</p>
22
23 <table class="nav" summary="Navigation aid" border="0" width=
24 "100%" cellpadding="0" cellspacing="0">
25 <tr>
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td>
27
28 <td valign="baseline" align="right"><a href=
29 "sigproc_methods.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Spectral Estimation Methods"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "sigproc_cpsd.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Cross-spectral density estimates"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Power spectral density estimates</h1>
37 <hr>
38
39 <p>
40 <h2>Description</h2>
41 <p>
42 The LTPDA method <a href="matlab:doc('ao/psd')">ao/psd</a> estimates the power spectral density of time-series
43 signals, included in the input <tt>ao</tt>s following the Welch's averaged, modified periodogram method <a href="#references">[1]</a>.
44 Data are windowed prior to the estimation of the spectrum, by multiplying
45 it with a <a href="specwin.html">spectral window object</a>, and can be detrended by a polinomial of time in order to reduce the impact
46 of the border discontinuities. The window length is adjustable to shorter lenghts to reduce the spectral
47 density uncertainties, and the percentage of subsequent window overlap can be adjusted as well. The detrending is
48 performed on the individual windows. The user can choose the quantity being given in output among
49 ASD (amplitude spectral density), PSD (power spectral density), AS (amplitude spectrum), and PS (power spectrum).
50 <br>
51 <br>
52 <h2>Syntax</h2>
53 </p>
54 <div class="fragment"><pre>
55 <br> bs = psd(a1, a2, a3, ..., pl)
56 bs = psd(as, pl)
57 bs = as.psd(pl)
58 </pre> </div>
59 <p>
60 <tt>a1</tt>, <tt>a2</tt>, <tt>a3</tt>, ... are <tt>ao</tt>(s) containing the input time series to be evaluated. <tt>bs</tt> includes
61 the output object(s) and <tt>pl</tt> is an optional parameter list.
62 </p>
63 <h2>Parameters</h2>
64 <p>
65 The parameter list <tt>pl</tt> includes the following parameters:
66 </p>
67 <ul>
68 <li> <tt>'Nfft'</tt> - number of samples in each fft [default: length of input data]
69 A string value containing the variable 'fs' can
70 also be used, e.g., plist('Nfft', '2*fs') </li>
71 <li> <tt>'Win'</tt> - the window to be applied to the data to remove the
72 discontinuities at edges of segments. [default: taken from user prefs].<br>
73 The window is described by a string with its name and, only in the case of Kaiser window,
74 the additional parameter <tt>'psll'</tt>. <br>For instance: plist('Win', 'Kaiser', 'psll', 200). </li>
75 </li>
76 <li> <tt>'Olap'</tt> - segment percent overlap [default: -1, (taken from window function)] </li>
77 <li> <tt>'Scale'</tt> - scaling of output. Choose from: <ul>
78 <li> 'ASD' - amplitude spectral density </li>
79 <li> 'PSD' - power spectral density [default] </li>
80 <li> 'AS' - amplitude spectrum </li>
81 <li> 'PS' - power spectrum </li> </ul> </li>
82 <li> <tt>'Order'</tt> - order of segment detrending <ul>
83 <li> -1 - no detrending </li>
84 <li> 0 - subtract mean [default] </li>
85 <li> 1 - subtract linear fit </li>
86 <li> N - subtract fit of polynomial, order N </li> </ul> </li>
87 <li><tt>'Navs'</tt> - number of averages. If set, and if Nfft was set to 0 or -1, the number of points for each window will be calculated to match the request. [default: -1, not set] </li>
88 <li><tt>'Times'</tt> - interval of time to evaluate the calculation on. If empty [default], it will take the whole section.</li>
89 </ul>
90 <p>
91 The length of the window is set by the value of the parameter <tt>'Nfft'</tt>, so that the window
92 is actually built using only the key features of the window: the name and, for Kaiser windows, the psll.
93 </p>
94 <p>As an alternative to setting the number of points <tt>'Nfft'</tt> in each window, it's possible to ask for a given number of PSD estimates by setting the <tt>'Navs'</tt> parameter, and the algorithm takes care of calculating the correct window length, according to the amount of overlap between subsequent segments.</p>
95 <p>
96 <table cellspacing="0" class="note" summary="Note" cellpadding="5" border="1">
97 <tr width="90%">
98 <td>
99 If the user doesn't specify the value of a given parameter, the default value is used.
100 </td>
101 </tr>
102 </table>
103 </p>
104 <h2>Algorithm</h2>
105 <p>
106 The algorithm is based in standard MATLAB's tools, as the ones used by <a href="matlab:doc('pwelch')">pwelch</a>. However, in order to
107 compute the standard deviation of the mean for each frequency bin, the averaging of the different segments is performed using Welford's
108 algorithm <a href="#references">[2]</a> which allows to compute mean and variance in one loop.
109 </p>
110 <h2>Examples</h2>
111 <p>
112 1. Evaluation of the PSD of a time-series represented by a low frequency sinewave signal, superimposed to
113 white noise. Comparison of the effect of windowing on the estimate of the white noise level and
114 on resolving the signal.
115 </p>
116 <div class="fragment"><pre>
117 <br> <span class="comment">% create two AOs</span>
118 x1 = ao(plist(<span class="string">'waveform'</span>,<span class="string">'sine wave'</span>,<span class="string">'f'</span>,0.1,<span class="string">'A'</span>,1,<span class="string">'nsecs'</span>,1000,<span class="string">'fs'</span>,10));
119 x2 = ao(plist(<span class="string">'waveform'</span>,<span class="string">'noise'</span>,<span class="string">'type'</span>,<span class="string">'normal'</span>,<span class="string">'nsecs'</span>,1000,<span class="string">'fs'</span>,10));
120 <span class="comment">% add both AOs</span>
121 x = x1 + x2;
122 <span class="comment">% compute the psd changing the 'nfft'</span>
123 y_lf = psd(x);
124 y_hf = psd(x,plist(<span class="string">'nfft'</span>,1000));
125 <span class="comment">% compare </span>
126 iplot(y_lf, y_hf)
127 </pre></div>
128
129 <img src="images/psd_1.png" alt="" border="3">
130
131 <p>
132 2. Evaluation of the PSD of a time-series represented by a low frequency sinewave signal, superimposed to
133 white noise and to a low frequency linear drift. In the example, the same spectrum is computed with different
134 spectral windows.
135 </p>
136 <div class="fragment"><pre>
137 <br> <span class="comment">% create three AOs</span>
138 x1 = ao(plist(<span class="string">'waveform'</span>,<span class="string">'sine wave'</span>,<span class="string">'f'</span>,0.1,<span class="string">'A'</span>,1,<span class="string">'nsecs'</span>,1000,<span class="string">'fs'</span>,10,<span class="string">'yunits'</span>,<span class="string">'m'</span>));
139 x2 = ao(plist(<span class="string">'waveform'</span>,<span class="string">'noise'</span>,<span class="string">'type'</span>,<span class="string">'normal'</span>,<span class="string">'nsecs'</span>,1000,<span class="string">'fs'</span>,10,<span class="string">'yunits'</span>,<span class="string">'m'</span>));
140 x3 = ao(plist(<span class="string">'tsfcn'</span>, <span class="string">'t.^2 + t'</span>,<span class="string">'nsecs'</span>,1000,<span class="string">'fs'</span>,10,<span class="string">'yunits'</span>,<span class="string">'m'</span>));
141 <span class="comment">% add them</span>
142 x = x1 + x2 + x3;
143 <span class="comment">% compute psd with different windows</span>
144 y_1 = psd(x,plist(<span class="string">'scale'</span>,<span class="string">'ASD'</span>,<span class="string">'order'</span>,1,<span class="string">'win'</span>,<span class="string">'BH92'</span>));
145 y_2 = psd(x,plist(<span class="string">'scale'</span>,<span class="string">'ASD'</span>,<span class="string">'order'</span>,2,<span class="string">'win'</span>,<span class="string">'Hamming'</span>));
146 y_3 = psd(x,plist(<span class="string">'scale'</span>,<span class="string">'ASD'</span>,<span class="string">'order'</span>,2,<span class="string">'win'</span>,<span class="string">'Kaiser'</span>,<span class="string">'psll'</span>,200));
147 <span class="comment">% compare</span>
148 iplot(y_1, y_2, y_3);
149 </pre></div>
150 <p>
151 <img src="images/psd_2.png" alt="" border="3">
152 </p>
153 <h2><a name="references">References</a></h2>
154
155 <ol>
156 <li> P.D. Welch, The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging Over Short,
157 Modified Periodograms, <i>IEEE Trans. on Audio and Electroacoustics</i>, Vol. 15, No. 2 (1967), pp. 70 - 73.</a></li>
158 <li> B. P. Weldford, Note on a Method for Calculating Corrected Sums of Squares and Products,
159 <i>Technometrics<i>, Vol. 4, No. 3 (1962), pp 419 - 420.</li>
160 </ol>
161
162
163 </p>
164
165 <br>
166 <br>
167 <table class="nav" summary="Navigation aid" border="0" width=
168 "100%" cellpadding="0" cellspacing="0">
169 <tr valign="top">
170 <td align="left" width="20"><a href="sigproc_methods.html"><img src=
171 "b_prev.gif" border="0" align="bottom" alt=
172 "Spectral Estimation Methods"></a>&nbsp;</td>
173
174 <td align="left">Spectral Estimation Methods</td>
175
176 <td>&nbsp;</td>
177
178 <td align="right">Cross-spectral density estimates</td>
179
180 <td align="right" width="20"><a href=
181 "sigproc_cpsd.html"><img src="b_next.gif" border="0" align=
182 "bottom" alt="Cross-spectral density estimates"></a></td>
183 </tr>
184 </table><br>
185
186 <p class="copy">&copy;LTP Team</p>
187 </body>
188 </html>