comparison m-toolbox/html_help/help/ug/constructor_examples_smodel_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 <!-- $Id: constructor_examples_smodel_content.html,v 1.1 2009/09/30 21:39:43 ingo Exp $ -->
2
3 <!-- -------------------------------------------------- -->
4 <!-- --------------- BEGIN CONTENT FILE --------------- -->
5 <!-- -------------------------------------------------- -->
6
7
8 <!-- --------------- Link box: begin --------------- -->
9 <table border="0" summary="Simple list" class="simplelist_nottable_last">
10 <tr>
11 <td>
12 <a href="constructor_examples_general.html#copy">Copy a symbolic model object</a>
13 </td>
14 </tr>
15 <tr>
16 <td>
17 <a href="constructor_examples_general.html#empty">Construct an empty symbolic model object</a>
18 </td>
19 </tr>
20 <tr>
21 <td>
22 <a href="constructor_examples_general.html#zero">Construct an empty symbolic model object with the size zero</a>
23 </td>
24 </tr>
25 <tr>
26 <td>
27 <a href="constructor_examples_general.html#file">Construct a symbolic model object by loading the object from a file</a>
28 </td>
29 </tr>
30 <tr>
31 <td>
32 <a href="#simple">Construct a simple example</a>
33 </td>
34 </tr>
35 <tr>
36 <td>
37 <a href="matlab:web(smodel.getInfo('smodel').tohtml, '-helpbrowser')">Construct an LTPDA object from a parameter list object (PLIST)</a>
38 </td>
39 </tr>
40 </table>
41
42 <!-- --------------- NEXT EXAMPLE --------------- -->
43
44 <hr>
45 <h2 class="title"><a name="simple"></a>A simple example</h2>
46 <p>The following example shows you how to create a symbolic model.</p>
47 <div class="fragment"><pre class="programlisting">
48 >> s = smodel(<span class="string">'a.*x.^2+b.*x+c'</span>);
49 </pre></div>
50 <p>You define with the command above the symbolic model. Please take care that each symbolic can represent a vector/matrix of numbers.
51 This mean that you should use the array operators like '.*' or '.+' or ... and not the matrix operators like '*' or '^' or ....</p>
52 <p>Now, it is necessary to define the parameters with their default values</p>
53 <div class="fragment"><pre class="programlisting">
54 >> s.setParams({<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>}, {1 2 3})
55 ---- symbolic model 1 ----
56 name: None
57 expr: a.*x.^2+b.*x+c
58 params: {'a', 'b', 'c'}
59 values: {1, 2, 3}
60 xvar:
61 xvals: []
62 xunits: []
63 yunits: []
64 description:
65 UUID: 7a084750-89c2-47f0-8c6b-65e9079bf6b3
66 --------------------------
67 </pre></div>
68 <p>Finally it is necessary to set the 'x' variable and the values.</p>
69 <div class="fragment"><pre class="programlisting">
70 >> s.setXvar(<span class="string">'x'</span>)
71 ---- symbolic model 1 ----
72 name: None
73 expr: a.*x.^2+b.*x+c
74 params: {'a', 'b', 'c'}
75 values: {1, 2, 3}
76 xvar: x
77 xvals: []
78 xunits: []
79 yunits: []
80 description:
81 UUID: ca9276b0-cc97-4001-9135-00c6799ec8b1
82 --------------------------
83
84 >> s.setXvals(-100:100)
85 ---- symbolic model 1 ----
86 name: None
87 expr: a.*x.^2+b.*x+c
88 params: {'a', 'b', 'c'}
89 values: {1, 2, 3}
90 xvar: x
91 xvals: [-100 -99 -98 -97 -96 -95 -94 -93 -92 -91 -90 -89 -88 -87 -86 ...]
92 xunits: []
93 yunits: []
94 description:
95 UUID: f43e2f9b-3fb6-4e3c-92ba-7cba31c6a6c3
96 --------------------------
97 </pre></div>
98 <p>After all steps above it is possible to plot the model.</p>
99 <div class="fragment"><pre class="programlisting">
100 >> s.setXunits(<span class="string">'s'</span>);
101 >> s.setYunits(<span class="string">'V'</span>);
102 >> s.setName(<span class="string">'Just a test'</span>);
103 >> iplot(s.eval)
104 </pre></div>
105
106 <img src="images/constructor_examples_smodel_plot.png" alt="Plot of symbolic model" border="3" width="800px"></img>
107
108
109
110
111
112
113
114
115
116
117
118
119
120