When using scatter, how can I delete all the repeated values except the minimum for each x value?

1 次查看(过去 30 天)
I am plotting data that has more than one y value for every x value. I'm using scatter(x,y) to plot this, but I want to only show the minimum of each x value. Both x and y are 14641 x 1 vectors. Any suggestions?

采纳的回答

Walter Roberson
Walter Roberson 2015-6-18
[ux, iax, icx] = unique(x);
min_at_x = accumarray(icx, y, [], @min);
scatter(ux, min_at_x);
  2 个评论
Lance Noel
Lance Noel 2015-6-18
编辑:Lance Noel 2015-6-18
I think that this worked, to a degree, but it's still not exactly what I want. See the image- essentially I only want the points at the bottom edge of that "curve". So there might be a min that's substantially higher than its neighboring min's that I would want to delete. I guess there's another step involved.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by