简体   繁体   中英

Find the coordinate that gives the min y-value

Let's say I have two vectors, same size.

Call it x and y.

I do a plot

figure
plot(x,y,'.')

It gives me some scatter plot. I see a minimum point on the graph. How do I extract that coordinate?

Should I combine the 2 vectors x and y and use find function?

Let's suppose you have

x = [9;8;7;6;0;5;4;3;2;1];
y = [0;1;2;3;4;5;6;7;8;9];

Then, you can do this:

[M, idx] = min(y);
min_point = [x(idx) y(idx)]

MATLAB min documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM