help-octave
[Top][All Lists]
Advanced

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

Re: optimizing error: undefined argument


From: Doug Stewart
Subject: Re: optimizing error: undefined argument
Date: Tue, 16 Aug 2011 06:55:03 -0400



On Tue, Aug 16, 2011 at 4:57 AM, DGati <address@hidden> wrote:
Hi octave users,

I'm currently trying out the different optimizers in the optim-package on
Octave 3.2.4, such as minimize(), line_min, or nmsmax. The file I'm
minimizing (or in case of nmsmax, I'm maximizing the file*-1) is for
simplicity's sake:

function result = func(x)
result=0.5*(x)^2-10;
endfunction

The error that I keep getting is

error: 'x' undefined near line 2, column 7
error: evaluating argument list element number 1
error: evaluating argument list element number 1

I don't understand that. How more should I define 'x'  when it is simply the
argument of the function?
Thanks for tips!


To use your function you must pass a number to it like:

func(6)

or

w=6
func(w)

this will not give an error, But

func
will give the error that you are seeing.


Doug
 

reply via email to

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