How can I which value that be used to calculate a function

Tianze Li (view profile)

on 14 May 2019
Latest activity Commented on by Fangjun Jiang

on 17 May 2019

Fangjun Jiang (view profile)

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!!!!!

Tags

No tags entered yet.

R2019a

Fangjun Jiang (view profile)

on 14 May 2019
Edited by Fangjun Jiang

Fangjun Jiang (view profile)

on 14 May 2019

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)

Tianze Li

Tianze Li (view profile)

on 17 May 2019
Yes. It did show the row and coloum for both x and y. But how can i display the value from that row and coloum instead of to find them from the array
Fangjun Jiang

Fangjun Jiang (view profile)

on 17 May 2019
Not clear what you mean. Maybe in your example, you are looking for x(Ix), y(Iy)?