Mercurial > hg > ltpda
diff m-toolbox/html_help/help/ug/sigproc_cohere_content.html @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/html_help/help/ug/sigproc_cohere_content.html Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,123 @@ +<h2>Description</h2> +<p> + The LTPDA method <a href="matlab:doc('ao/cohere')">ao/cohere</a> estimates the cross-coherence of time-series + signals, included in the input <tt>ao</tt>s following the Welch's averaged, modified periodogram method <a href="#references">[1]</a>. + Data are windowed prior to the estimation of the spectra, by multiplying + 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 + of the border discontinuities. The window length is adjustable to shorter lenghts to reduce the spectral + density uncertainties, and the percentage of subsequent window overlap can be adjusted as well. + <br> + <br> + <h2>Syntax</h2> +</p> +<div class="fragment"><pre> + <br> b = cohere(a1,a2,pl) + </pre> +</div> +<p> + <tt>a1</tt> and <tt>a2</tt> are the 2 <tt>ao</tt>s containing the input time series to be evaluated, <tt>b</tt> is the output object and + <tt>pl</tt> is an optional parameters list. + <h2>Parameters</h2> +The parameter list <tt>pl</tt> includes the following parameters:</p> +<ul> + <li> <tt>'Nfft'</tt> - number of samples in each fft [default: length of input data] + Notice: analyzing a single segment produces as a result an object full of 1! + A string value containing the variable 'fs' can + also be used, e.g., plist('Nfft', '2*fs') </li> + <li> <tt>'Win'</tt> - the window to be applied to the data to remove the + discontinuities at edges of segments. [default: taken from user prefs].<br> + The window is described by a string with its name and, only in the case of Kaiser window, + the additional parameter <tt>'psll'</tt>. <br>For instance: plist('Win', 'Kaiser', 'psll', 200). </li> + <li> <tt>'Olap'</tt> - segment percent overlap [default: -1, (taken from window function)] </li> + <li> <tt>'Order'</tt> - order of segment detrending <ul> + <li> -1 - no detrending </li> + <li> 0 - subtract mean [default] </li> + <li> 1 - subtract linear fit </li> + <li> N - subtract fit of polynomial, order N </li> </ul> </li> + <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> + <li><tt>'Times'</tt> - interval of time to evaluate the calculation on. If empty [default], it will take the whole section.</li> +<li><tt>'Type'</tt> - type of scaling of the coherence function. Choose between:</li> +<ul> + <li> <tt>'C'</tt> - Complex Coherence Sxy / sqrt(Sxx * Syy) [default]</li> + <li> <tt>'MS'</tt> - Magnitude-Squared Coherence (abs(Sxy))^2 / (Sxx * Syy) </li> + </ul> +</ul> +The length of the window is set by the value of the parameter <tt>'Nfft'</tt>, so that the window +is actually rebuilt using only the key features of the window, i.e. the name and, for Kaiser windows, the PSLL. +</p> + +<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 coherence 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> +<p> + <table cellspacing="0" class="note" summary="Note" cellpadding="5" border="1"> + <tr width="90%"> + <td> + If the user doesn't specify the value of a given parameter, the default value is used. + </td> + </tr> + </table> +</p> + +<p> + The function makes cross-coherence estimates between the 2 input <tt>ao</tt>s. +If passing two identical objects or linearly combined signals, the output will be 1 at all frequencies. The same will happen if analyzing only a single window.</p> +<h2>Algorithm</h2> +<p> + The algorithm is based in standard MATLAB's tools, as the ones used by <a href="matlab:doc('pwelch')">pwelch</a>. The standard deviation of the mean is computed as <a href="#references">[2]</a> + <div align="center"> + <img src="images/cohere_sigma1.png" > +</div> +where + <div align="center"> + <img src="images/tfe_sigma2.png" > +</div> +is the coherence function. +<p> + <h2>Example</h2> +</p> +<p> + Evaluation of the cross-coherence of two time-series represented by: a low frequency sinewave signal superimposed to + white noise and a linear drift, and a low frequency sinewave signal at the same frequency, phase shifted and with different + amplitude, superimposed to white noise. +</p> +<div class="fragment"><pre> + <br> <span class="comment">% parameters</span> + nsecs = 5000; + fs = 10; + nfft = 1000; + + <span class="comment">% build first signal components</span> + 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>,nsecs,<span class="string">'fs'</span>,fs,<span class="string">'yunits'</span>,<span class="string">'m'</span>)) + 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>,nsecs,<span class="string">'fs'</span>,fs,<span class="string">'yunits'</span>,<span class="string">'m'</span>)) + x3 = ao(plist(<span class="string">'tsfcn'</span>, <span class="string">'t'</span>,<span class="string">'nsecs'</span>,nsecs,<span class="string">'fs'</span>,fs,<span class="string">'yunits'</span>,<span class="string">'m'</span>)); + + <span class="comment">% add components</span> + x = x1 + x2 + x3; + + <span class="comment">% build second signal components</span> + y1 = 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>,2,<span class="string">'nsecs'</span>,nsecs,<span class="string">'fs'</span>,fs,<span class="string">'phi'</span>,90)); + y2 = 4*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>,nsecs,<span class="string">'fs'</span>,fs)); + + <span class="comment">% add components and set units</span> + y = y1 + y2; + y.setYunits(<span class="string">'V'</span>); + + <span class="comment">% compute coherence</span> + pl = plist(<span class="string">'win'</span>,<span class="string">'BH92'</span>,<span class="string">'nfft'</span>,nfft, <span class="string">'order'</span>,1); + Cxy = cohere(x,y,pl); + + <span class="comment">%plot</span> + iplot(Cxy); + </pre> +</div> +<br> + +<img src="images/cohere_1.png" border="3"> + +<h2><a name="references">References</a></h2> +<br> +<ol> + <li> P.D. Welch, The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging Over Short, +Modified Periodograms, <i>IEEE Trans. on Audio and Electroacoustics</i>, Vol. 15, No. 2 (1967), pp. 70 - 73.</a></li> + <li> G.C. Carter, C.H. Knapp, A.H. Nuttall, Estimation of the Magnitude-Squared Coherence Function Via Overlapped Fast Fourier Transform Processing + , <i>IEEE Trans. on Audio and Electroacoustics</i>, Vol. 21, No. 4 (1973), pp. 337 - 344.</a></li> +</ol>