help-octave
[Top][All Lists]
Advanced

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

Re: passing parameters to fzero, fsolve?


From: Muhali
Subject: Re: passing parameters to fzero, fsolve?
Date: Sat, 8 Aug 2009 23:55:35 -0700 (PDT)


James Sherman Jr.-2 wrote:
> 
> It might help if you post what you're currently doing and why you find
> what you're currently doing hard/undesirable.  Then, we may be able to
> offer some better help.
> 

ok, here is an example:

octave:1> function y = foo(x, p)
> y = log(x+p) - 1 ;
> endfunction
octave:2> p = 1 ;
octave:3> options.abstol = 1e-2 ;
octave:4> fzero("foo", 1, options)
error: `p' undefined near line 2 column 11
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:   foo at line 2, column 3
error:   /home/gerd/loc/octave-3.2/share/octave/3.2.2/m/optimization/fzero.m
at line 105, column 6
octave:4> fzero("foo", 1, options, p)
error: Invalid call to fzero.  Correct usage is:

 -- Function File: [X, FVAL, INFO, OUTPUT] = fzero (FUN, X0, OPTIONS)


Additional help for built-in functions and operators is
available in the on-line version of the manual.  Use the command
`doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the address@hidden
mailing list.
octave:4> pkg load optim
octave:5> fzero("foo", [-5 5], options, p)
ans = -2.5195

-- 
View this message in context: 
http://www.nabble.com/passing-parameters-to-fzero%2C-fsolve--tp24873660p24884689.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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