0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 Spectral windows are typically used in spectral analysis algorithms. In all LTPDA spectral analysis
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 functions, spectral windows are specified as parameters in an input parameter list. The following
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 example shows the use of <tt>ao/psd</tt> to estimate an Amplitude Spectral Density of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 the time-series captured in the input AO, <tt>a</tt>. The help for <a href="matlab:doc('ao/ao/psd')">ao/lpsd</a>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 reveals that the required parameter for setting the window function is <tt>'Win'</tt>.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 </p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 <div class="fragment"><pre>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 <br> <span class="comment">% Parameters</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 nsecs = 1000;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 fs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 <span class="comment">% Create input AOs</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 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));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 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));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 <span class="comment">% Add both</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 x = x1 + x2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 <span class="comment">% Compute psd with Blackman-Harris window</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 z = psd(x,plist(<span class="string">'win'</span>,<span class="string">'BH92'</span>));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 <span class="comment">% Plot</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 iplot(z);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 </pre></div>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 In this case, the size of the spectral window (number of samples) may not match the length
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 of the segments in the spectral estimation. The <tt>psd</tt> algorithm then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 recomputes the window using the input design but for the correct length of window function.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 </p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 <img src="images/specwin_using1.png" >
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 <h2>Selecting the Peak Side-Lobe level (psll) with Kaiser's window</h2>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 The <a href="specwin_description.html">table</a> in the previous section shows how each standard spectral window is defined by the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 Peak Side-Lobe level (<tt>psll</tt>). However, Kaiser's window allows the user to define the <tt>psll</tt> of the window.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 </p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 The following example shows the importance of selecting a suitable <tt>psll</tt> according to each application. The example creates
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 1/f noise (in fact, noise generated
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 by a pole-zero model with a pole at low frequencies) and computes the Amplitude Spectrum Density (ASD) with three different <tt>psll</tt>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 values. The ASD with the lowest value shows a bias at high frequencies compared with the response of the pzmodel used to generate
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 the data (in black). This effect is due to the power added by the high order lobes of the window. The ASD with the highet value of the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 <tt>psll</tt> adds a feature at low frequencies because the main lobe of the window is too wide. Only the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 middle value gives an estimation of the ASD without adding window related features.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 </p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 <div class="fragment"><pre>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 <br> <span class="comment">% Parameters</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 nsecs = 10000;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 fs = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 <span class="comment">% Create pzmodel with a low frequency pole</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 pzm = pzmodel(1e5,[1e-7,0.1],[]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 <span class="comment">% Build (nearly) 1/f noise</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 x = ao(plist(<span class="string">'pzmodel'</span>,pzm, <span class="string">'nsecs'</span>,nsecs, <span class="string">'fs'</span>,fs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 <span class="comment">% Compute psd with Blackman-Harris window</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 z1 = psd(x,plist(<span class="string">'scale'</span>,<span class="string">'ASD'</span>,<span class="string">'win'</span>,<span class="string">'Kaiser'</span>,<span class="string">'psll'</span>,50));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 z1.setName(<span class="string">'psll = 50'</span>);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 z2 = psd(x,plist('scale',<span class="string">'ASD'</span>,<span class="string">'win'</span>,<span class="string">'Kaiser'</span>,<span class="string">'psll'</span>,100));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 z2.setName(<span class="string">'psll = 100'</span>);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 z3 = psd(x,plist(<span class="string">'scale'</span>,<span class="string">'ASD'</span>,<span class="string">'win'</span>,<span class="string">'Kaiser'</span>,<span class="string">'psll'</span>,1000));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 z3.setName(<span class="string">'psll = 1000'</span>);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 <span class="comment">% Plot</span>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 r = resp(pzm,plist(<span class="string">'f1'</span>,1e-4,<span class="string">'f2'</span>,1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 r.setName(<span class="string">'response'</span>)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 r.setPlotinfo(plist(<span class="string">'color'</span>,<span class="string">'k'</span>))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 iplot(z1,z2,z3,abs(r));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 </pre></div>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 <img src="images/specwin_using2.png" >
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78
|