Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/gapfill_content.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 <h2>Description</h2> | |
2 <p> | |
3 Gaps in data can be filled with <i>interpolated</i> data if desired. LTPDA <a href="matlab:doc('ao/gapfilling')"><tt>gapfilling</tt></a> joins two AOs | |
4 by means of a segment of <i>synthetic</i> data. This segment is calculated from the two input AOs. Two different | |
5 methods are possible to fill the gap in the data: <tt>linear</tt> and <tt>spline</tt>. The former fills the data | |
6 by means of a linear interpolation whereas the latter uses a smoother curve ---see examples below. | |
7 <br> | |
8 <br> | |
9 <h2>Syntax</h2> | |
10 </p> | |
11 <div class="fragment"><pre> | |
12 <br> | |
13 b = gapfilling(a1, a2, pl) | |
14 </pre> | |
15 </div> | |
16 <p> | |
17 where <tt>a1</tt> and <tt>a2</tt> are the two segments to join. | |
18 </p> | |
19 <h2>Parameters</h2> | |
20 The following parameters apply for this method: | |
21 <ul> | |
22 <li><tt>'method'</tt> - method used to interpolate missing data (see below for details) | |
23 <ul> | |
24 <li> <tt>'linear'</tt> (default option) </li> | |
25 <li> <tt>'spline'</tt> </li> | |
26 </ul> | |
27 <li><tt>'addnoise'</tt> - with this option <i>noise</i> can be | |
28 added to the interpolated data. | |
29 This noise is defined as a <br> | |
30 random variable with | |
31 zero mean and variance equal to the high-frequency | |
32 noise of the input AO. </li> | |
33 | |
34 </ul> | |
35 </p> | |
36 <p> | |
37 <h2>Algorithm</h2> | |
38 </p> | |
39 <p> | |
40 <b>Linear :</b> The gap is filled using a linear approximation. | |
41 </p> | |
42 <p> | |
43 <div align="center"> | |
44 <IMG src="images/spike50x.png" width="205" height="27" border="0"> | |
45 </div> | |
46 </p> | |
47 <br> | |
48 the notation used in the previous expression is schematically explained in the figure below | |
49 <br> | |
50 <p> | |
51 <div align="center"> | |
52 <img src="images/interplinear1.png" border="1" width="400px"> | |
53 </div> | |
54 </p> | |
55 <br> | |
56 <br> | |
57 <br> | |
58 <p> | |
59 <b>Spline :</b> a third order interpolation is used in this case | |
60 </p> | |
61 <p> | |
62 <br> | |
63 <div align="center"> | |
64 <IMG src="images/spike51x.png" width="237" height="16" border="0"> | |
65 </div> | |
66 <br> | |
67 </p> | |
68 <p> | |
69 The parameters <tt>a</tt>, <tt>b</tt>, <tt>c</tt> and <tt>d</tt> are calculated | |
70 by solving next system of equations: | |
71 </p> | |
72 <p> | |
73 <div align="center"> | |
74 <IMG src="images/spike52x.png" width="205" height="117" border="0"> | |
75 </div> | |
76 </p> | |
77 <br> | |
78 The result is schematically shown in the figure below | |
79 <br> | |
80 <p> | |
81 <div align="center"> | |
82 <img src="images/interpspline.png" border="0" width="400px"> | |
83 </div> | |
84 </p> | |
85 <br> | |
86 <p> | |
87 <h2>Examples</h2> | |
88 </p> | |
89 <p> | |
90 1. Missing data between two vectors of random data interpolated with the <tt>linear</tt> method. | |
91 </p> | |
92 <p> | |
93 <div class="fragment"><pre> | |
94 <br> | |
95 x1 = ao(plist(<span class="string">'waveform'</span>,<span class="string">'noise'</span>,<span class="string">'nsecs'</span>,1e3,<span class="string">'fs'</span>,10,<span class="string">'name'</span>,<span class="string">'noise'</span>)); <span class="comment">% create an AO of random data</span> | |
96 xs = split(x1,plist(<span class="string">'chunks'</span>,3)); <span class="comment">% split in three segments</span> | |
97 pl = plist( <span class="string">'method'</span>, <span class="string"> 'linear'</span>, <span class="string">'addnoise'</span>, <span class="string">'no'</span>); <span class="comment">% linear gapfilling</span> | |
98 y = gapfilling(xs(1),xs(3), pl); <span class="comment">% fill between 2nd and 3rd segment</span> | |
99 iplot(x1,y) | |
100 </pre> | |
101 </div> | |
102 </p> | |
103 <p> | |
104 <div align="center"> | |
105 <img src="images/gapexample1.png" border="1" > | |
106 </div> | |
107 </p> | |
108 <br> | |
109 <br> | |
110 <p> | |
111 2. Missing data between two data vectors interpolated with the <tt>spline</tt> method. | |
112 </p> | |
113 <p> | |
114 <div class="fragment"><pre> | |
115 <br> | |
116 x1 = ao(plist(<span class="string">'tsfcn'</span>,<span class="string">'t.^1.8 + 1e6*rand(size(t))'</span>,<span class="string">'nsecs'</span>,5e3,<span class="string">'fs'</span>,10,<span class="string">'name'</span>,<span class="string">'noise'</span>)); <span class="comment">% create an AO</span> | |
117 xs = split(x1,plist(<span class="string">'chunks'</span>,3)); <span class="comment">% split in three segments</span> | |
118 pl = plist( <span class="string">'method'</span>, <span class="string"> 'spline'</span>, <span class="string">'addnoise'</span>, <span class="string">'no'</span>); <span class="comment">% cubic gapfilling</span> | |
119 y = gapfilling(xs(1),xs(3), pl); <span class="comment">% fill between 2nd and 3rd segment</span> | |
120 iplot(x1,y) | |
121 </pre> | |
122 </div> | |
123 </p> | |
124 <p> | |
125 <div align="center"> | |
126 <img src="images/gapexample2.png" border="1"> | |
127 </div> | |
128 </p> | |
129 | |
130 | |
131 |