comparison m-toolbox/html_help/help/ug/sigproc_example_ao_linlsqsvd_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
2
3
4 <p>Determine the coefficients of a linear combination of noises and comapre with lscov</p>
5 <h2>Contents</h2>
6 <div>
7 <ul>
8 <li><a href="#1">Make data</a></li>
9 <li><a href="#2">Do fit and check results</a></li>
10 </ul>
11 </div>
12
13 <h2>Make data<a name="1"></a></h2>
14
15 <div class="fragment"><pre>
16
17 fs = 10;
18 nsecs = 10;
19
20 <span class="comment">% Elements of the fit basis</span>
21 B1 = ao(plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</span>, <span class="string">'fs'</span>, fs, <span class="string">'nsecs'</span>, nsecs, <span class="string">'yunits'</span>, <span class="string">'T'</span>));
22 B1.setName;
23 B2 = ao(plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</span>, <span class="string">'fs'</span>, fs, <span class="string">'nsecs'</span>, nsecs, <span class="string">'yunits'</span>, <span class="string">'T'</span>));
24 B2.setName;
25 B3 = ao(plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</span>, <span class="string">'fs'</span>, fs, <span class="string">'nsecs'</span>, nsecs, <span class="string">'yunits'</span>, <span class="string">'T'</span>));
26 B3.setName;
27
28 <span class="comment">% random additive noise</span>
29 n = ao(plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</span>, <span class="string">'fs'</span>, fs, <span class="string">'nsecs'</span>, nsecs, <span class="string">'yunits'</span>, <span class="string">'m'</span>));
30
31 <span class="comment">% coefficients of the linear combination</span>
32 c1 = ao(1,plist(<span class="string">'yunits'</span>,<span class="string">'m/T'</span>));
33 c1.setName;
34
35 c2 = ao(2,plist(<span class="string">'yunits'</span>,<span class="string">'m/T'</span>));
36 c2.setName;
37
38 c3 = ao(3,plist(<span class="string">'yunits'</span>,<span class="string">'m T^-1'</span>));
39 c3.setName;
40
41 <span class="comment">% build output of linear system</span>
42 y = c1*B1 + c2*B2 + c3*B3 + n;
43 y.simplifyYunits;
44
45 </pre></div>
46
47
48 <h2>Do fit and check results<a name="2"></a></h2>
49
50 <div class="fragment"><pre>
51
52 <span class="comment">% Get a fit with linlsqsvd</span>
53 pobj1 = linlsqsvd(B1, B2, B3, y)
54
55 </pre></div>
56
57 <div class="fragment"><pre>
58
59 ---- pest 1 ----
60 name: a1*B1+a2*B2+a3*B3
61 param names: {'a1', 'a2', 'a3'}
62 y: [0.81162366736073077;1.8907151217948008;3.0098623857384701]
63 dy: [0.091943725803872112;0.089863977231447567;0.097910574305897308]
64 yunits: [m T^(-1)][m T^(-1)][m T^(-1)]
65 pdf: []
66 cov: [3x3], ([0.00845364871469762 0.000268768332741779 0.000180072770333592;0.000268768332741779 0.00807553440385413 0.00125972375325089;0.000180072770333592 0.00125972375325089 0.00958648056091064])
67 corr: [3x3], ([1 0.0325289738130578 0.020003055941376;0.0325289738130578 1 0.143172656986983;0.020003055941376 0.143172656986983 1])
68 chain: []
69 chi2: 0.87276552675043451
70 dof: 97
71 models: B1/tsdata Ndata=[100x1], fs=10, nsecs=10, t0=1970-01-01 00:00:00.000 UTC, B2/tsdata Ndata=[100x1], fs=10, nsecs=10, t0=1970-01-01 00:00:00.000 UTC, B3/tsdata Ndata=[100x1], fs=10, nsecs=10, t0=1970-01-01 00:00:00.000 UTC
72 description:
73 UUID: b8628843-a1e8-4815-b69b-90efdadc16c2
74 ----------------
75
76 </pre></div>
77
78 <div class="fragment"><pre>
79
80 <span class="comment">% do linear combination: using eval</span>
81 yfit = pobj1.eval(B1, B2, B3);
82
83 <span class="comment">% Plot - compare data with fit result</span>
84 iplot(y, yfit)
85
86 </pre></div>
87
88 <p>
89 <div align="center">
90 <IMG src="images/example_ao_linlsqsvd_01.png" align="center" border="0">
91 </div>
92 </p>
93
94