The min(y) function where y is a vector
1 visualizzazione (ultimi 30 giorni)
Fangjun Jiang il 12 Nov 2011
In your code, x is a scalar. It is over-written every iteration in the for-loop.
min() can return the index.
Wayne King il 12 Nov 2011
[minval,index] = min(y);
In this case it's trivial since index is the x value at which the minimum occurs. This function is increasing on your x values, so the minimum is at the first element.