comparison m-toolbox/html_help/help/ug/constructor_examples_smodel.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>Constructor examples of the SMODEL class (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 "constructor_examples_ao.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Constructor examples of the AO class"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "constructor_examples_mfir.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Constructor examples of the MFIR class"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Constructor examples of the SMODEL class</h1>
37 <hr>
38
39 <p>
40
41 <!-- -------------------------------------------------- -->
42 <!-- --------------- BEGIN CONTENT FILE --------------- -->
43 <!-- -------------------------------------------------- -->
44
45
46 <!-- --------------- Link box: begin --------------- -->
47 <table border="0" summary="Simple list" class="simplelist_nottable_last">
48 <tr>
49 <td>
50 <a href="constructor_examples_general.html#copy">Copy a symbolic model object</a>
51 </td>
52 </tr>
53 <tr>
54 <td>
55 <a href="constructor_examples_general.html#empty">Construct an empty symbolic model object</a>
56 </td>
57 </tr>
58 <tr>
59 <td>
60 <a href="constructor_examples_general.html#zero">Construct an empty symbolic model object with the size zero</a>
61 </td>
62 </tr>
63 <tr>
64 <td>
65 <a href="constructor_examples_general.html#file">Construct a symbolic model object by loading the object from a file</a>
66 </td>
67 </tr>
68 <tr>
69 <td>
70 <a href="#simple">Construct a simple example</a>
71 </td>
72 </tr>
73 <tr>
74 <td>
75 <a href="matlab:web(smodel.getInfo('smodel').tohtml, '-helpbrowser')">Construct an LTPDA object from a parameter list object (PLIST)</a>
76 </td>
77 </tr>
78 </table>
79
80 <!-- --------------- NEXT EXAMPLE --------------- -->
81
82 <hr>
83 <h2 class="title"><a name="simple"></a>A simple example</h2>
84 <p>The following example shows you how to create a symbolic model.</p>
85 <div class="fragment"><pre class="programlisting">
86 >> s = smodel(<span class="string">'a.*x.^2+b.*x+c'</span>);
87 </pre></div>
88 <p>You define with the command above the symbolic model. Please take care that each symbolic can represent a vector/matrix of numbers.
89 This mean that you should use the array operators like '.*' or '.+' or ... and not the matrix operators like '*' or '^' or ....</p>
90 <p>Now, it is necessary to define the parameters with their default values</p>
91 <div class="fragment"><pre class="programlisting">
92 >> s.setParams({<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>}, {1 2 3})
93 ---- symbolic model 1 ----
94 name: None
95 expr: a.*x.^2+b.*x+c
96 params: {'a', 'b', 'c'}
97 values: {1, 2, 3}
98 xvar:
99 xvals: []
100 xunits: []
101 yunits: []
102 description:
103 UUID: 7a084750-89c2-47f0-8c6b-65e9079bf6b3
104 --------------------------
105 </pre></div>
106 <p>Finally it is necessary to set the 'x' variable and the values.</p>
107 <div class="fragment"><pre class="programlisting">
108 >> s.setXvar(<span class="string">'x'</span>)
109 ---- symbolic model 1 ----
110 name: None
111 expr: a.*x.^2+b.*x+c
112 params: {'a', 'b', 'c'}
113 values: {1, 2, 3}
114 xvar: x
115 xvals: []
116 xunits: []
117 yunits: []
118 description:
119 UUID: ca9276b0-cc97-4001-9135-00c6799ec8b1
120 --------------------------
121
122 >> s.setXvals(-100:100)
123 ---- symbolic model 1 ----
124 name: None
125 expr: a.*x.^2+b.*x+c
126 params: {'a', 'b', 'c'}
127 values: {1, 2, 3}
128 xvar: x
129 xvals: [-100 -99 -98 -97 -96 -95 -94 -93 -92 -91 -90 -89 -88 -87 -86 ...]
130 xunits: []
131 yunits: []
132 description:
133 UUID: f43e2f9b-3fb6-4e3c-92ba-7cba31c6a6c3
134 --------------------------
135 </pre></div>
136 <p>After all steps above it is possible to plot the model.</p>
137 <div class="fragment"><pre class="programlisting">
138 >> s.setXunits(<span class="string">'s'</span>);
139 >> s.setYunits(<span class="string">'V'</span>);
140 >> s.setName(<span class="string">'Just a test'</span>);
141 >> iplot(s.eval)
142 </pre></div>
143
144 <img src="images/constructor_examples_smodel_plot.png" alt="Plot of symbolic model" border="3" width="800px"></img>
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160 </p>
161
162 <br>
163 <br>
164 <table class="nav" summary="Navigation aid" border="0" width=
165 "100%" cellpadding="0" cellspacing="0">
166 <tr valign="top">
167 <td align="left" width="20"><a href="constructor_examples_ao.html"><img src=
168 "b_prev.gif" border="0" align="bottom" alt=
169 "Constructor examples of the AO class"></a>&nbsp;</td>
170
171 <td align="left">Constructor examples of the AO class</td>
172
173 <td>&nbsp;</td>
174
175 <td align="right">Constructor examples of the MFIR class</td>
176
177 <td align="right" width="20"><a href=
178 "constructor_examples_mfir.html"><img src="b_next.gif" border="0" align=
179 "bottom" alt="Constructor examples of the MFIR class"></a></td>
180 </tr>
181 </table><br>
182
183 <p class="copy">&copy;LTP Team</p>
184 </body>
185 </html>