secons max number in a vector

1 次查看(过去 30 天)
Hi I need to find maximum and second maximum number in a vector. Can you please help?
For max, its max(X), but for second max I am unable to figure out.
Your help is appreciated
P

采纳的回答

Rick Rosson
Rick Rosson 2011-11-24
a = max(X);
Y = X(X ~= a);
b = max(Y);
  4 个评论
Walter Roberson
Walter Roberson 2011-11-25
There are apparently efficient linear-time routines to find the N largest or N smallest numbers in a list, and supposedly they do not need to do a mini-sort of N elements to find the proper place in the list for each new value being tested. I have not yet been able to understand the logic in the paper that describes the internal comparison scheme.
Rick Rosson
Rick Rosson 2011-11-25
Everyone makes mistakes. Glass houses...

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by