I should preface this post by saying that I have never used fminsearch for multivariable functions and I am not a heavy user of anonymous functions.
I have defined a function myfun2:
function f = myfun2(x,y,xc,yc)
n = length(x) f = sqrt((sum((sqrt((xc - x).^2 + (yc - y).^2) - ... sum(sqrt((xc - x).^2 + (yc - y).^2)/n)).^2)/n)) end
where x and y are vectors (of length upwards of 10,000) and xc and yc are scalars. Basically, I have known x and y vectors and I want to find xc and yc such that f is minimized. I've read through the fminsearch documentation and posts on the Matlab newgroups and I have not been able to find any information as to how to do so.