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

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

[Octave-bug-tracker] [bug #41888] fminsearch: should pass additional arg


From: H. G.
Subject: [Octave-bug-tracker] [bug #41888] fminsearch: should pass additional arguments to called function
Date: Mon, 17 Mar 2014 20:02:19 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0

URL:
  <http://savannah.gnu.org/bugs/?41888>

                 Summary: fminsearch: should pass additional arguments to
called function
                 Project: GNU Octave
            Submitted by: hardy
            Submitted on: Mo 17 Mär 2014 20:02:18 GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.1
        Operating System: Any

    _______________________________________________________

Details:

Here is an example of a (for me and my colleagues) normal usage of the
fminsearch function. It works perfectly well in Matlab, but it throws an error
in Octave (no Forge packages):
* myfun.m contains:

function f = myfun(x,a)
f = x(1)^2 + a*x(2)^2;

* demo script with fminsearch:

param = 1.5; % define a parameter for the function myfun
options = optimset;
start = [1,3];
result = fminsearch(@myfun, start, options, param)

In Matlab the "surplus" parameter param is handed over to the called function
(here: myfun) as a static (i.e. non variable) parameter. This will also work
with more than one surplus parameters (if the called function expects them) in
Matlab.

It would be nice to have the same behavior in Octave, because this is a very
handy way to hand over parameters to an "error function", and not to use
global variables for this purpose.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41888>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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