Filter löschen
Filter löschen

secons max number in a vector

1 Ansicht (letzte 30 Tage)
PChoppala
PChoppala am 24 Nov. 2011
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

Akzeptierte Antwort

Rick Rosson
Rick Rosson am 24 Nov. 2011
a = max(X);
Y = X(X ~= a);
b = max(Y);
  4 Kommentare
Walter Roberson
Walter Roberson am 25 Nov. 2011
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 am 25 Nov. 2011
Everyone makes mistakes. Glass houses...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Polar Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by