Getting max Y-Value and draw a new line
Show older comments
Hi, I have time data of a simulation, that give several Y-Values for one X-Value.
I want to get the max. Y-Value for each X, like the red line: Before:

After:

Data:
4 Comments
Walter Roberson
on 24 Sep 2015
Edited: Walter Roberson
on 24 Sep 2015
What is the data structure? Is all of the data being plotted at one time based upon a single Y matrix, or is all of the data being plotted at one time based upon a plot() statement that lists a lot of x/y pairs, or is the data being created incrementally through a loop? Are all of the x coordinates exactly the same (guaranteed) for each y, or might there be round-off error that cause them to be slightly different, or are they only "close to" being the same? (e.g. if everything in the same 10000 points out of 8 million is intended to represent the same x for the purpose of finding the maximum then that is very different than the values being absolutely definitely the same.)
Marv
on 24 Sep 2015
Walter Roberson
on 24 Sep 2015
Only about 0.5 % of your x values are duplicated.
You may need something similar to http://www.mathworks.com/help/signal/ug/envelope-extraction-using-the-analytic-signal.html
Marv
on 24 Sep 2015
Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!