MATLAB: How to find argmin to this vector

#argmin-vector

c=argmin f(a,b).where both a,b are M*1 and N*1 column matrices respectively.
How to get a,b for minimum value of f(a,b) from matlab

Best Answer

Are you looking for something like this?
Let a,b be your column matrices.
[a,b] = meshgrid(a,b) ; % make them a matrix
F = f(a,b) ; % evaluate your function, use element by element operations in f
[val,idx] = min(F(:)) ;
amin = a(idx) ;
bmin = b(idx) ;
Have a look on fmincon.