<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165926</link>
    <title>MATLAB Central Newsreader - fminsearch matab problem</title>
    <description>Feed for thread: fminsearch matab problem</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 18 Mar 2008 20:05:37 -0400</pubDate>
      <title>fminsearch matab problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165926#421586</link>
      <author>jimpx</author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
I want to pass a number of variables through fminsearch. Because of the structure of the program, some of those variables must be held constant while the others are minimized. Is there a way to do this with fminsearch, or is there another minimization program which allows this?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
jimpx</description>
    </item>
    <item>
      <pubDate>Wed, 19 Mar 2008 15:27:10 -0400</pubDate>
      <title>Re: fminsearch matab problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165926#421749</link>
      <author>Arthur G</author>
      <description>On 2008-03-18 12:05:37 -0400, jimpx &amp;lt;falloncolm@gmail.com&amp;gt; said:&lt;br&gt;
&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I want to pass a number of variables through fminsearch. Because of the &lt;br&gt;
&amp;gt; structure of the program, some of those variables must be held constant &lt;br&gt;
&amp;gt; while the others are minimized. Is there a way to do this with &lt;br&gt;
&amp;gt; fminsearch, or is there another minimization program which allows this?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; jimpx&lt;br&gt;
&lt;br&gt;
Write another (possibly anonymous) function that you use with &lt;br&gt;
fminsearch. This anonymous function has for its inputs only those &lt;br&gt;
variables you want to minimize with respect to, and others are help &lt;br&gt;
constant. Here's an example using anonymous functions:&lt;br&gt;
&lt;br&gt;
f = @(x,y) (x-y).^2; % A function of two variables&lt;br&gt;
g = @(y) f(3, y); % Function &quot;f&quot;, with x=3&lt;br&gt;
yOpt = fminsearch(g, 0);&lt;br&gt;
&lt;br&gt;
--Arthur</description>
    </item>
    <item>
      <pubDate>Thu, 20 Mar 2008 18:41:02 -0400</pubDate>
      <title>Re: fminsearch matab problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165926#422016</link>
      <author>Thomas Clark</author>
      <description>Even simpler, use a nested program structure!&lt;br&gt;
&lt;br&gt;
Your m-file should read like this:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
function [output] = my_optimisation(inputs)&lt;br&gt;
% MY_OPTIMISATION does blah blah (header description)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% Make an initial guess&lt;br&gt;
guess = make_first_guess(inputs);&lt;br&gt;
&lt;br&gt;
% Calculate some other stuff&lt;br&gt;
things_i_want_constant = some_computations();&lt;br&gt;
&lt;br&gt;
% Perform the search, passing a handle to your nested&lt;br&gt;
function as the evaluation function&lt;br&gt;
x = fminsearch(@evaluation_fun,guess);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% Define the nested evaluation function&lt;br&gt;
function [score] = evaluation_function(guess);&lt;br&gt;
&lt;br&gt;
% Insert code to return a score as a function of guess. &lt;br&gt;
% Note that this nested function also has access to the&lt;br&gt;
% variables in the main function, &lt;br&gt;
% e.g. the things_i_want_constant&lt;br&gt;
score = ... your code....&lt;br&gt;
&lt;br&gt;
% End the nested function&lt;br&gt;
end&lt;br&gt;
% End the main function&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
jimpx &amp;lt;falloncolm@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;26104615.1205870768015.JavaMail.jakarta@nitrogen.mathforum.org&amp;gt;...&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I want to pass a number of variables through fminsearch.&lt;br&gt;
Because of the structure of the program, some of those&lt;br&gt;
variables must be held constant while the others are&lt;br&gt;
minimized. Is there a way to do this with fminsearch, or is&lt;br&gt;
there another minimization program which allows this?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; jimpx</description>
    </item>
  </channel>
</rss>

