comparison m-toolbox/html_help/help/ug/sigproc_cohere.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>Cross coherence 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_cpsd.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Cross-spectral density estimates"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "sigproc_tfe.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Transfer function estimates"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Cross coherence estimates</h1>
37 <hr>
38
39 <p>
40 <h2>Description</h2>
41 <p>
42 The LTPDA method <a href="matlab:doc('ao/cohere')">ao/cohere</a> estimates the cross-coherence 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 spectra, 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.
48 <br>
49 <br>
50 <h2>Syntax</h2>
51 </p>
52 <div class="fragment"><pre>
53 <br> b = cohere(a1,a2,pl)
54 </pre>
55 </div>
56 <p>
57 <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
58 <tt>pl</tt> is an optional parameters list.
59 <h2>Parameters</h2>
60 The parameter list <tt>pl</tt> includes the following parameters:</p>
61 <ul>
62 <li> <tt>'Nfft'</tt> - number of samples in each fft [default: length of input data]
63 Notice: analyzing a single segment produces as a result an object full of 1!
64 A string value containing the variable 'fs' can
65 also be used, e.g., plist('Nfft', '2*fs') </li>
66 <li> <tt>'Win'</tt> - the window to be applied to the data to remove the
67 discontinuities at edges of segments. [default: taken from user prefs].<br>
68 The window is described by a string with its name and, only in the case of Kaiser window,
69 the additional parameter <tt>'psll'</tt>. <br>For instance: plist('Win', 'Kaiser', 'psll', 200). </li>
70 <li> <tt>'Olap'</tt> - segment percent overlap [default: -1, (taken from window function)] </li>
71 <li> <tt>'Order'</tt> - order of segment detrending <ul>
72 <li> -1 - no detrending </li>
73 <li> 0 - subtract mean [default] </li>
74 <li> 1 - subtract linear fit </li>
75 <li> N - subtract fit of polynomial, order N </li> </ul> </li>
76 <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>
77 <li><tt>'Times'</tt> - interval of time to evaluate the calculation on. If empty [default], it will take the whole section.</li>
78 <li><tt>'Type'</tt> - type of scaling of the coherence function. Choose between:</li>
79 <ul>
80 <li> <tt>'C'</tt> - Complex Coherence Sxy / sqrt(Sxx * Syy) [default]</li>
81 <li> <tt>'MS'</tt> - Magnitude-Squared Coherence (abs(Sxy))^2 / (Sxx * Syy) </li>
82 </ul>
83 </ul>
84 The length of the window is set by the value of the parameter <tt>'Nfft'</tt>, so that the window
85 is actually rebuilt using only the key features of the window, i.e. the name and, for Kaiser windows, the PSLL.
86 </p>
87
88 <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>
89 <p>
90 <table cellspacing="0" class="note" summary="Note" cellpadding="5" border="1">
91 <tr width="90%">
92 <td>
93 If the user doesn't specify the value of a given parameter, the default value is used.
94 </td>
95 </tr>
96 </table>
97 </p>
98
99 <p>
100 The function makes cross-coherence estimates between the 2 input <tt>ao</tt>s.
101 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>
102 <h2>Algorithm</h2>
103 <p>
104 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>
105 <div align="center">
106 <img src="images/cohere_sigma1.png" >
107 </div>
108 where
109 <div align="center">
110 <img src="images/tfe_sigma2.png" >
111 </div>
112 is the coherence function.
113 <p>
114 <h2>Example</h2>
115 </p>
116 <p>
117 Evaluation of the cross-coherence of two time-series represented by: a low frequency sinewave signal superimposed to
118 white noise and a linear drift, and a low frequency sinewave signal at the same frequency, phase shifted and with different
119 amplitude, superimposed to white noise.
120 </p>
121 <div class="fragment"><pre>
122 <br> <span class="comment">% parameters</span>
123 nsecs = 5000;
124 fs = 10;
125 nfft = 1000;
126
127 <span class="comment">% build first signal components</span>
128 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>))
129 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>))
130 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>));
131
132 <span class="comment">% add components</span>
133 x = x1 + x2 + x3;
134
135 <span class="comment">% build second signal components</span>
136 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));
137 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));
138
139 <span class="comment">% add components and set units</span>
140 y = y1 + y2;
141 y.setYunits(<span class="string">'V'</span>);
142
143 <span class="comment">% compute coherence</span>
144 pl = plist(<span class="string">'win'</span>,<span class="string">'BH92'</span>,<span class="string">'nfft'</span>,nfft, <span class="string">'order'</span>,1);
145 Cxy = cohere(x,y,pl);
146
147 <span class="comment">%plot</span>
148 iplot(Cxy);
149 </pre>
150 </div>
151 <br>
152
153 <img src="images/cohere_1.png" border="3">
154
155 <h2><a name="references">References</a></h2>
156 <br>
157 <ol>
158 <li> P.D. Welch, The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging Over Short,
159 Modified Periodograms, <i>IEEE Trans. on Audio and Electroacoustics</i>, Vol. 15, No. 2 (1967), pp. 70 - 73.</a></li>
160 <li> G.C. Carter, C.H. Knapp, A.H. Nuttall, Estimation of the Magnitude-Squared Coherence Function Via Overlapped Fast Fourier Transform Processing
161 , <i>IEEE Trans. on Audio and Electroacoustics</i>, Vol. 21, No. 4 (1973), pp. 337 - 344.</a></li>
162 </ol>
163
164 </p>
165
166 <br>
167 <br>
168 <table class="nav" summary="Navigation aid" border="0" width=
169 "100%" cellpadding="0" cellspacing="0">
170 <tr valign="top">
171 <td align="left" width="20"><a href="sigproc_cpsd.html"><img src=
172 "b_prev.gif" border="0" align="bottom" alt=
173 "Cross-spectral density estimates"></a>&nbsp;</td>
174
175 <td align="left">Cross-spectral density estimates</td>
176
177 <td>&nbsp;</td>
178
179 <td align="right">Transfer function estimates</td>
180
181 <td align="right" width="20"><a href=
182 "sigproc_tfe.html"><img src="b_next.gif" border="0" align=
183 "bottom" alt="Transfer function estimates"></a></td>
184 </tr>
185 </table><br>
186
187 <p class="copy">&copy;LTP Team</p>
188 </body>
189 </html>