octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57446] fminsearch fails due to undocumented M


From: Nick
Subject: [Octave-bug-tracker] [bug #57446] fminsearch fails due to undocumented Matlab feature of passing extra parameters
Date: Fri, 20 Dec 2019 15:30:42 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36

Follow-up Comment #2, bug #57446 (project octave):

Thanks for the response Kai, very helpful!

My function fssr is contained in it's own file (fssr.m). The function is
rather long but takes vectors x,y,xmax and ymax as arguments and then
minimises two parameter contained in pm0. I would like to write something like
the below with the anonymous function, but it does not work. y is undefined
when fssr is called (y is the first argument used in fssr).

I would much appreciate any advice
_______________

f = @(pm0, x, y, xmax, ymax)fssr;

%Define test data
c = magic(5);
y = c(:,2); x = c(:,1); ymax = c(:,4); xmax = c(:,3);
    
%Create anonymous function
fun = @(pm0)f(pm0, x, y, xmax, ymax);

%Define initial guess
pm0 = [-3; -2];  

%Search for minimum   
[pm, ssr] = fminsearch(fun, pm0)

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57446>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]