Samuel,<div><br></div><div>Thanks for your reply.</div><div><br></div><div>If I understood you correctly, I did the change as you suggested but it still crashes. You were right, my function u(t) returned a vector, and I picked the correct value inside the other function.</div>
<div>Now, my function u(t) returns the exact value for u(t), a scalar. </div><div>I can simulate all the functions normally with no error, but whenever I try to optimize it with nelder_mead, Sci-lab crashes. Unfortunately, it's too fast for me to see the error message. Is there a log file that I can check?</div>
<div>Since the file is pretty small, I attached the file. </div><div><br></div><div>Thank you. </div><div>Carlos</div><div><br></div><div><div class="gmail_quote">On Thu, Feb 25, 2010 at 12:59 PM, Samuel Gougeon <span dir="ltr"><<a href="mailto:Samuel.Gougeon@univ-lemans.fr" target="_blank">Samuel.Gougeon@univ-lemans.fr</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Carlos Eduardo Celia de Lima <<a href="mailto:carlosedlima@gmail.com" target="_blank">carlosedlima@gmail.com</a>> a écrit :<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I am trying to run an optimization using Scilab but it crashes when I<br>
execute it.<br>
</blockquote>
<br></div>
Hello Carlos,<br>
Just having a look at your script and embedded function definitions,<br>
some questions arise, that may be of concern for the crash:<br>
* In function xdot=f(t,x,u), you are using z=u(t)<br>
  while latter in the script, you define function ut=u(t,alpha).<br>
  I guess that z=u(t) adresses the u passed as an input<br>
  parameter of f(), and not the function u(). But this is not obvious,<br>
  and there may be a confusion.<br>
* Same thing inside function ut=u(t,alpha) : with<br>
  u(1)=alpha(1);  // line 55)<br>
  u((c*i)+1)=alpha(i+1); // line 57<br>
  While both lines could be interpreted as recursive calls to the<br>
  _function_ u() only by a not enough clever parser (since u() is here<br>
  Left Hand Side argument), the next case on line 63 in stranger:<br>
  u(i+1)=u(i)+ (((time0(i+1)-time0(i))/(time0(w+2)-time0(i)))*(u(w+2)-u(i)));<br>
  where u(i) and u(w+2) may be understood as recursive calls to the function u().<br>
  Finally, line 66:<br>
  ut=u'; // Whether the parser understands u as the function, then transposing<br>
  a function could be an issue for it.<br>
<br>
I don't know if the confusion between both u() as a function and as a vector<br>
is the issue. Nevertheless, it could be worthwhile to rename one of both,<br>
and then try again.<br>
<br>
HTH<br><font color="#888888">
Samuel<br>
<br>
</font></blockquote></div><br></div>