Hello,
On Mon, June 11, 2007 01:33, rambovn wrote:
#
# Hi,
# I am newbie in octave so I have many questions :)
# Now I am want to find the minimum of a function of several variables. # I am
trying with fmins but the results are not like I expected :,( # I
want to limit the result for example: My function have x , y as variables, #
and I want that x value is in the range from 0 to 1, and y is positive.
How # can I do that with fmins? Or is there any other function in octave that
can # do it for me?
I don't know that Octave has a constrained multi-variable function (does anyone
know otherwise?), but you can transform your function, say 'f',
defined on [0,1] x [0,+infty] so it's domain is [-infty,+infty] x
[-infty,+infty].
function z = g (xy)
z = f (1/2 + tanh (x(1))/2, exp (x(2));
end
That's a well-known trick, see an optimization textbook. Then, with a little
luck (your mileage may vary, as with all local minimization methods)
xy_0 = fmins (g, xy_init)
should give you x_min = 1/2 + tanh (xy_0(1))/2 and y_min = exp (xy_0(2)).
Hth,
Etienne
# Thank you very much for any help.
# Regards
# Anh
# --
# View this message in context:
http://www.nabble.com/Question-about-fmins%21-tf3900212.html#a11056777 # Sent
from the Octave - General mailing list
archive at Nabble.com. #
# _______________________________________________
# Help-octave mailing list
# address@hidden
# https://www.cae.wisc.edu/mailman/listinfo/help-octave
#