help-octave
[Top][All Lists]
Advanced

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

Re: how to define right function for minimization


From: ontogenez
Subject: Re: how to define right function for minimization
Date: Sun, 11 Feb 2007 16:47:50 -0800 (PST)

could you explain? i'm a newbie in octave. i have a variable obtained from
previous solution. and i want to use it as a scalar for minimization
objective function.


address@hidden wrote:
> 
> your output of "f(a, x) " says you already do wrong, x must be 1st in
> minimization solvers
> one of solutions: try for example
> fun1 = @(x,param) (param*x-1)^2;
> a=2;
> [x fv] = fmins(@(x) fun1(x,a) ,0);
> in matlab it works but in my octave 2.9.9 as far as I remember - not, you
> should use direct substitution of a=2 or globals.
> for smooth funcs fminunc is better, for nonsmooth - my ralg() or
> ominsearch() is better than fmins (at least at those task I dealt with)
> WBR, Dmitrey
> 
> 
> ontogenez wrote:
>> 
>> i tried to use a constant for function minimization. i coded:
>> 
>> a=2
>> fun1=inline('(a*x-1)^2')
>> fmins(fun1,0)
>> 
>> octave gives me 
>> a = 2
>> fun1 =
>> 
>> f(a, x) = (a*x-1)^2
>> 
>> error: `x' undefined near line 2 column 12
>> error: evaluating binary operator `*' near line 2, column 11
>> error: evaluating binary operator `-' near line 2, column 13
>> error: evaluating binary operator `^' near line 2, column 16
>> error: called from `?unknown?'
>> error: evaluating binary operator `*' near line 63, column 12
>> error: evaluating assignment expression near line 63, column 6
>> error: called from `nmsmax' in file
>> `/usr/share/octave/site/m/octave-forge/optim/nmsmax.m'
>> error: evaluating assignment expression near line 78, column 9
>> error: called from `fmins' in file
>> `/usr/share/octave/site/m/octave-forge/optim/fmins.m'
>> error: near line 3 of file `/usr/share/octave/site/m/minimization.m'
>> 
>> how can i define function with a=2?
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-define-right-function-for-minimization-tf3209722.html#a8917093
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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