Z P wrote:
Dear all,

suppose I have a bi-variate function f(x,y), I want to find the maxima. I define x and y vector, and get matrix z=f(x,y). how can I get which (x0,y0) makes z become the maxima?

If you have function values as matrix, you may simply use:


which(z==max(z), arr.ind=TRUE)

or you can consider to use an optimization algorithm directly on your function, see ?optim or ?nlm.

Hope it helps

Thomas P.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to