Find the maxima in a graph

2 vues (au cours des 30 derniers jours)
Ricky
Ricky le 22 Mai 2013
I know that this question has been answered a lot of times in this forum but I am a beginner in MATLAB and I was not able to find a suitable solution for myself.
[IMG]http://i40.tinypic.com/nx4cih.jpg[/IMG]. or http://tinypic.com/r/nx4cih/5
here is the link for uploaded graph. The variable which I am plotting has dimensions of 2705*196. How can i find the maximum peak of the graph.
  1 commentaire
Ricky
Ricky le 23 Mai 2013
Hello find the link for uploaded file
simply use plot command. I want to find maxima of this data. The graph I uploaded in tinypic.

Connectez-vous pour commenter.

Réponses (3)

Image Analyst
Image Analyst le 22 Mai 2013
Try this:
[maxDataValue, indexAtMax] = max(yourData);
  3 commentaires
Ricky
Ricky le 22 Mai 2013
Hello Image Analyst, I am sorry I am not able to upload the data as these websites are blocked in my office
Ricky
Ricky le 22 Mai 2013
Modifié(e) : Ricky le 22 Mai 2013
Hello Image analyst find the link for uploaded file
simply use plot command. I want to find maxima of this data. The graph I uploaded in tinypic.

Connectez-vous pour commenter.


Iain
Iain le 22 Mai 2013
[m K] = max(Variable(:)) tells you the maximum value anywhere in Variable (m), and it's index (K).
  4 commentaires
Image Analyst
Image Analyst le 22 Mai 2013
Modifié(e) : Image Analyst le 23 Mai 2013
He showed one dimensional data in his screenshot, not 2D data. That's why I didn't use (:). Plus the values will be the same no matter if the 1D data is a row vector or a column vector. A row vector will not give you the value of each column back - it will give you the max like you expect. If someone has a 2D matrix and want the overall matrix then (:) is correct. Of course it will also work with 1D arrays as well though it's not necessary.
Iain
Iain le 23 Mai 2013
Ah - Due to the firewall I'm stuck with here, I can't see the screenshot.

Connectez-vous pour commenter.


José-Luis
José-Luis le 22 Mai 2013
Sounds like you want the sub indexes (row, column) not the linear indexes.
your_data = rand(10,20);
[row col] = ind2sub(size(your_data),find(your_data == max(your_data(:))))
  8 commentaires
Ricky
Ricky le 23 Mai 2013
Hi
First of all I would like to apologise for my mistake. The data is indeed a two dimensional data with 2705 rows and 196 column. The graph that I am plotting is like a maxima of each column. So there are some columns where all the values are zero and some columns where I get some values which are plotted.
I still do not understand I am plotting 2d data with simple plot command. I am using MATLAB version R 2013a.
José-Luis
José-Luis le 23 Mai 2013
Then you get the maximums with what Image Analyst suggested. Please look at the documentation for max().
If you want the row, columns of each column maximum, then you need to transform the linear indexes to subindexes. Please look at ind2sub().
If you want to plot a surface (2d data) then you can't use plot(). Please look at the documentation for surf(). There you will find links to similar plotting tools, that could also work.

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by