<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#330000">
    Hi<br>
    <br>
    The objective function should be a real number, I believe. <br>
    If this si true, it should not have the same size than the data
    vector (it should be 1x1 real number)<br>
    <br>
    May be you could use a norm of the cost function you are currently
    using. Do that using scilab function norm.<br>
    <br>
    Hope it helps<br>
    <br>
    On 17/08/2011 17:09, Peter Hinow wrote:
    <blockquote
cite="mid:1274391701.23522.1313617158901.JavaMail.root@mail06.pantherlink.uwm.edu"
      type="cite">
      <pre wrap="">Dear fellows,

is there a "canonical" way to fit the solution of a parameter-dependent ordinary differential equation y' = f(y;p) to some experimental data? 

I have tried leastsq, but the optimal solution is always the initial guess, regardless of the initial guess. Specifically, I'm not able to get any information why leastsq terminates, even when I add the option "imp=2" (the "optimal" gradient has an entry of order 10^21). When I try datafit instead, I get an error like

Submatrix incorrectly defined.
at line      26 of function costf called by :  
at line     174 of function datafit called by :  

even though the output of the objective function has the same size as the data vector.

Thank you very much for your help,
     Peter

</pre>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      <p style="color:teal; font-size:12pt;"><b>Adrien Vogt-Schilb</b><br>
        Research Fellow<br>
        <a class="moz-txt-link-abbreviated" href="mailto:vogt@centre-cired.fr">vogt@centre-cired.fr</a><br>
        Tel: (+33) 1 43 94 73 96<br>
        Fax: (+33) 1 43 94 73 70<br>
      </p>
      <table style="border:none;">
        <tbody>
          <tr>
            <td style="padding:0pt 0pt 0pt 0pt;">
              <p><img src="cid:part1.07030909.01080600@centre-cired.fr"
                  alt="CIRED" width="54"></p>
            </td>
            <td style="padding:0pt 7pt 0pt 7pt;" valign="middle">
              <p style="font-size:10pt; color:teal">45 bis, Av de la
                Belle Gabrielle<br>
                F-94736 Nogent-sur-Marne<br>
                <a href="http://www.centre-cired.fr/" style="color:teal">http://www.centre-cired.fr/</a><br>
              </p>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>