comparison m-toolbox/html_help/help/ug/sigproc_example_ao_linlsqsvd.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>Linear least squares with singular value deconposition - single experiment (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_linear_param_estimation_svd.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Linear Parameter Estimation with Singular Value Decomposition"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "sigproc_example_matrix_linlsqsvd.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Linear least squares with singular value deconposition - multiple experiments"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Linear least squares with singular value deconposition - single experiment</h1>
37 <hr>
38
39 <p>
40
41
42
43 <p>Determine the coefficients of a linear combination of noises and comapre with lscov</p>
44 <h2>Contents</h2>
45 <div>
46 <ul>
47 <li><a href="#1">Make data</a></li>
48 <li><a href="#2">Do fit and check results</a></li>
49 </ul>
50 </div>
51
52 <h2>Make data<a name="1"></a></h2>
53
54 <div class="fragment"><pre>
55
56 fs = 10;
57 nsecs = 10;
58
59 <span class="comment">% Elements of the fit basis</span>
60 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>));
61 B1.setName;
62 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>));
63 B2.setName;
64 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>));
65 B3.setName;
66
67 <span class="comment">% random additive noise</span>
68 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>));
69
70 <span class="comment">% coefficients of the linear combination</span>
71 c1 = ao(1,plist(<span class="string">'yunits'</span>,<span class="string">'m/T'</span>));
72 c1.setName;
73
74 c2 = ao(2,plist(<span class="string">'yunits'</span>,<span class="string">'m/T'</span>));
75 c2.setName;
76
77 c3 = ao(3,plist(<span class="string">'yunits'</span>,<span class="string">'m T^-1'</span>));
78 c3.setName;
79
80 <span class="comment">% build output of linear system</span>
81 y = c1*B1 + c2*B2 + c3*B3 + n;
82 y.simplifyYunits;
83
84 </pre></div>
85
86
87 <h2>Do fit and check results<a name="2"></a></h2>
88
89 <div class="fragment"><pre>
90
91 <span class="comment">% Get a fit with linlsqsvd</span>
92 pobj1 = linlsqsvd(B1, B2, B3, y)
93
94 </pre></div>
95
96 <div class="fragment"><pre>
97
98 ---- pest 1 ----
99 name: a1*B1+a2*B2+a3*B3
100 param names: {'a1', 'a2', 'a3'}
101 y: [0.81162366736073077;1.8907151217948008;3.0098623857384701]
102 dy: [0.091943725803872112;0.089863977231447567;0.097910574305897308]
103 yunits: [m T^(-1)][m T^(-1)][m T^(-1)]
104 pdf: []
105 cov: [3x3], ([0.00845364871469762 0.000268768332741779 0.000180072770333592;0.000268768332741779 0.00807553440385413 0.00125972375325089;0.000180072770333592 0.00125972375325089 0.00958648056091064])
106 corr: [3x3], ([1 0.0325289738130578 0.020003055941376;0.0325289738130578 1 0.143172656986983;0.020003055941376 0.143172656986983 1])
107 chain: []
108 chi2: 0.87276552675043451
109 dof: 97
110 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
111 description:
112 UUID: b8628843-a1e8-4815-b69b-90efdadc16c2
113 ----------------
114
115 </pre></div>
116
117 <div class="fragment"><pre>
118
119 <span class="comment">% do linear combination: using eval</span>
120 yfit = pobj1.eval(B1, B2, B3);
121
122 <span class="comment">% Plot - compare data with fit result</span>
123 iplot(y, yfit)
124
125 </pre></div>
126
127 <p>
128 <div align="center">
129 <IMG src="images/example_ao_linlsqsvd_01.png" align="center" border="0">
130 </div>
131 </p>
132
133
134
135 </p>
136
137 <br>
138 <br>
139 <table class="nav" summary="Navigation aid" border="0" width=
140 "100%" cellpadding="0" cellspacing="0">
141 <tr valign="top">
142 <td align="left" width="20"><a href="sigproc_linear_param_estimation_svd.html"><img src=
143 "b_prev.gif" border="0" align="bottom" alt=
144 "Linear Parameter Estimation with Singular Value Decomposition"></a>&nbsp;</td>
145
146 <td align="left">Linear Parameter Estimation with Singular Value Decomposition</td>
147
148 <td>&nbsp;</td>
149
150 <td align="right">Linear least squares with singular value deconposition - multiple experiments</td>
151
152 <td align="right" width="20"><a href=
153 "sigproc_example_matrix_linlsqsvd.html"><img src="b_next.gif" border="0" align=
154 "bottom" alt="Linear least squares with singular value deconposition - multiple experiments"></a></td>
155 </tr>
156 </table><br>
157
158 <p class="copy">&copy;LTP Team</p>
159 </body>
160 </html>