Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to find 2nd to 5th highest Point in Plot?

Subject: How to find 2nd to 5th highest Point in Plot?

From: Patrick Wang

Date: 28 Jan, 2009 23:42:02

Message: 1 of 3

Hi

I'm asked to set the window limit of plots that will be generated by matlab. So far, I used

[y,v] = max(a) function to find the maximum point on my plot. Since every time the graph will be plot on different x-axis. Is there way that I can find the 2nd to 5th highest point? so that I can set the x-axis limit on the 5th tab(highest point) on my graph. My plot is on Power vs Time profile, and time varies from 512 to 1024 ms.

Thank you.

Subject: How to find 2nd to 5th highest Point in Plot?

From: ImageAnalyst

Date: 29 Jan, 2009 00:03:47

Message: 2 of 3

Patrick:
Well, the sort() function comes to mind.
Regards,
ImageAnalyst

Subject: How to find 2nd to 5th highest Point in Plot?

From: vedenev

Date: 29 Jan, 2009 10:12:27

Message: 3 of 3

Example:

a=[5 6 7 3 4 9 1 2 6 4];
[tmp ind]=sort(a,'descend');

a(ind(1)) % first highest
a(ind(2)) % second highest
...

-----------------------------------------
Maxim Vedenev, MATLAB Custom Programming
vedenev@ngs.ru
http://simulations.narod.ru/

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us