Deleted vectorized computation feature. Deleted neldermead_contour. Fixed the demos.
[scilab.git] / scilab / modules / optimization / help / en_US / fit_dat.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <refentry version="5.0-subset Scilab" xml:id="fit_dat" xml:lang="en"
14           xmlns="http://docbook.org/ns/docbook"
15           xmlns:xlink="http://www.w3.org/1999/xlink"
16           xmlns:svg="http://www.w3.org/2000/svg"
17           xmlns:ns4="http://www.w3.org/1999/xhtml"
18           xmlns:mml="http://www.w3.org/1998/Math/MathML"
19           xmlns:db="http://docbook.org/ns/docbook">
20   <info>
21     <pubdate>$LastChangedDate$</pubdate>
22   </info>
23
24   <refnamediv>
25     <refname>fit_dat</refname>
26
27     <refpurpose>Parameter identification based on measured data</refpurpose>
28   </refnamediv>
29
30   <refsynopsisdiv>
31     <title>Calling Sequence</title>
32
33     <synopsis>[p,err]=fit_dat(G,p0,Z [,W] [,pmin,pmax] [,DG])</synopsis>
34   </refsynopsisdiv>
35
36   <refsection>
37     <title>Parameters</title>
38
39     <variablelist>
40       <varlistentry>
41         <term>G</term>
42
43         <listitem>
44           <para>Scilab function (e=G(p,z), e: nex1, p: npx1, z: nzx1)</para>
45         </listitem>
46       </varlistentry>
47
48       <varlistentry>
49         <term>p0</term>
50
51         <listitem>
52           <para>initial guess (size npx1)</para>
53         </listitem>
54       </varlistentry>
55
56       <varlistentry>
57         <term>Z</term>
58
59         <listitem>
60           <para>matrix [z_1,z_2,...z_n] where z_i (nzx1) is the ith
61           measurement</para>
62         </listitem>
63       </varlistentry>
64
65       <varlistentry>
66         <term>W</term>
67
68         <listitem>
69           <para>weighting matrix of size nexne (optional; default 1)</para>
70         </listitem>
71       </varlistentry>
72
73       <varlistentry>
74         <term>pmin</term>
75
76         <listitem>
77           <para>lower bound on p (optional; size npx1)</para>
78         </listitem>
79       </varlistentry>
80
81       <varlistentry>
82         <term>pmax</term>
83
84         <listitem>
85           <para>upper bound on p (optional; size npx1)</para>
86         </listitem>
87       </varlistentry>
88
89       <varlistentry>
90         <term>DG</term>
91
92         <listitem>
93           <para>partial of G wrt p (optional; S=DG(p,z), S: nexnp)</para>
94         </listitem>
95       </varlistentry>
96     </variablelist>
97   </refsection>
98
99   <refsection>
100     <title>Description</title>
101
102     <para><literal>fit_dat</literal> is used for fitting data to a model. For
103     a given function G(p,z), this function finds the best vector of parameters
104     p for approximating G(p,z_i)=0 for a set of measurement vectors z_i.
105     Vector p is found by minimizing
106     <literal>G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)</literal></para>
107   </refsection>
108
109   <refsection>
110     <title>Examples</title>
111
112     <programlisting role="example"><![CDATA[ 
113 deff('y=FF(x)','y=a*(x-b)+c*x.*x')
114 X=[];Y=[];
115 a=34;b=12;c=14;for x=0:.1:3, Y=[Y,FF(x)+100*(rand()-.5)];X=[X,x];end
116 Z=[Y;X];
117 deff('e=G(p,z)','a=p(1),b=p(2),c=p(3),y=z(1),x=z(2),e=y-FF(x)')
118
119 [p,err]=fit_dat(G,[3;5;10],Z)
120
121 xset('window',0)
122 xbasc();
123 plot2d(X',Y',-1) 
124 plot2d(X',FF(X)',5,'002')
125 a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
126
127 a=34;b=12;c=14;
128 deff('s=DG(p,z)','y=z(1),x=z(2),s=-[x-p(2),-p(1),x*x]')
129
130 [p,err]=fit_dat(G,[3;5;10],Z,DG)
131
132 xset('window',1)
133 xbasc();
134 plot2d(X',Y',-1) 
135 plot2d(X',FF(X)',5,'002')
136 a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
137  ]]></programlisting>
138   </refsection>
139
140   <refsection>
141     <title>See Also</title>
142
143     <simplelist type="inline">
144       <member><link linkend="optim">optim</link></member>
145
146       <member><link linkend="datafit">datafit</link></member>
147     </simplelist>
148   </refsection>
149 </refentry>