MATLAB: How to which value that be used to calculate a function

MATLAB

In this casue, I difine a range for x and y, and then calculated the min value of L, but how do i find which x vaule and y value to calculate the min L? Many thanks!!!!!

Best Answer

You need to run min() twice
A=magic(5);
[MinInCol,RowIndex]=min(A);
[MinValue,ColIndex]=min(MinInCol);
Position=[RowIndex(ColIndex),ColIndex];
or better
[MinValue,Index]=min(A(:));
[Ix,Iy]=ind2sub(size(A),Index)