<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#330000">
<div class="moz-cite-prefix">On 02/12/2012 19:06, Jens Simon Strom
wrote:<br>
</div>
<blockquote cite="mid:loom.20121202T185922-116@post.gmane.org"
type="cite">
<pre wrap="">Thank you Adrien,
I tried your approach before because it works with optim. It fails. The reason
is that "x" is a variable of fminsearch which interferes with "my" x.
The consequence is that one has to choose variables that are not defined in
fminsearch. This is quite disappointing for an elaborated language like Scilab.
Kind regards
Jens
</pre>
</blockquote>
<br>
Hi Jens<br>
<br>
I was surprised by your answer, os I tested the code. It works with
no problem in my Sci 5.4 under winXP:<br>
<br>
<br>
function SAQ=!f(p,x,y), SAQ=sum( ( p(1)+p(2)*x-y ).^2 ), endfunction<br>
x=1:1000 ;<br>
y=2*x+3;<br>
popt=fminsearch(list(!f,x,y),[0;0]);<br>
<br>
function SAQ=!f(p,xi,yi), SAQ=sum( ( p(1)+p(2)*xi-yi ).^2 ),
endfunction<br>
xi=1:1000 ;<br>
yi=2*x+3;<br>
popti=fminsearch(list(!f,xi,yi),[0;0]);<br>
<br>
<br>
popt-popti<br>
<br>
ans =<br>
<br>
0. 0. <br>
<br>
<br>
Kind regards<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<blockquote cite="mid:loom.20121202T185922-116@post.gmane.org"
type="cite">
<pre wrap="">
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>