help-octave
[Top][All Lists]
Advanced

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

Re: optimizing error: undefined argument


From: DGati
Subject: Re: optimizing error: undefined argument
Date: Tue, 16 Aug 2011 11:46:10 -0700 (PDT)

@Allen: Yes, I also tried nmsmax but not not sqp; thanks for the reference.


Jordi Gutiérrez Hermoso-2 wrote:
> 
> 
> What you instead want to write is
> 
>     some_func(@func, some_parameter)
> 
> i.e. create a handle to func with the @func syntax, and pass that to
> some_func. Most, perhaps all Octave functions also accept the name of
> the function in a string instead of a handle, so you can also write
> this instead:
> 
>      some_func("func", some_paramter)
> 
> HTH,
> - Jordi G. H.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
> 

This helps if I work with nmsmax (obviously with function rewritten as *-1).
However, minimize still isn't quite doing what it should. This is the
documentation for it:

[x,v,nev,...] = minimize (f,args,...) - Minimize f

 ARGUMENTS
 f    : string  : Name of function. Must return a real value
 args : list or : List of arguments to f (by default, minimize the first)
        matrix  : f's only argument

 RETURNED VALUES
 x   : matrix  : Local minimum of f. Let's suppose x is M-by-N.
 v   : real    : Value of f in x0
 nev : integer : Number of function evaluations 
     or 1 x 2  : Number of function and derivative evaluations (if
                 derivatives are used)
--> This means args should list the arguments. My function, x^2-10, only has
one argument. Thus I typed

octave-3.2.4.exe:37> minimize(@func,x)
error: for A^b, A must be square
error: called from:
error: D:\octwork\func.m at line 2, column 7

Putting a number instead of x won't do either. Thus, minimize(@func,1)
yields ans =-1, which is interesting not only because it's wrong, but also
because it doesn't follow the syntax minimize is supposed to have, the
returned value is completely different from how it should look.


--
View this message in context: 
http://octave.1599824.n4.nabble.com/optimizing-error-undefined-argument-tp3746683p3748080.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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