how to perform one plot
2 views (last 30 days)
Show older comments
Hi, I am waiting for to optimize the plot of some arrays I attached my figure to showing you my problem: I would to obtain a "cleaned" curve. I tried with the following code but it is not the solution:
my_datax = min(x):10:max(x)
my_datay = min(y):10:max(y)
neither with others steps
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153797/image.png)
Do you have any suggestions? Thank you
2 Comments
Ahmet Cecen
on 30 Jul 2014
What exactly do you mean when you say "cleaned"? Explain very explicitly what you would like to see as the end result.
Answers (2)
Star Strider
on 30 Jul 2014
It looks as though you are plotting:
plot(my_datax, my_datay, '-*')
Change the plot to:
plot(my_datax, my_datay, '-')
to plot the line without the markers.
9 Comments
Image Analyst
on 30 Jul 2014
See my attached demo of polyfit and I think you'll easily be able to see how you can adapt it to your data.
Star Strider
on 30 Jul 2014
Stefano — If you know the model, I can help you do the nonlinear parameter estimation to characterise your data. That is easiest if you have the Statistics Toolbox or the Optimization Toolbox, but is only slightly more difficult using fminsearch. If you post your model and attach at least one of your data sets (so I can test my code), we can work together on coding it and then doing the parameter estimation. You will probably have to explain the model to me if it is not in an area of my expertise, but unless it is an extremely complicated model, coding and estimating it should not be difficult.
IA — Thank you. That seems to be a well-received demo.
Joseph Cheng
on 30 Jul 2014
Edited: Joseph Cheng
on 30 Jul 2014
Depending on what you're trying to display (no labeled axes) perhaps using sort() or sortrows() to order the data in relation to x-axis data. This way there shouldn't be any back tracing in the plot.
Additionally sorting should help if you're looking at the "double" curve line for the cyan. After sorting you should be able to pick the max point of a rolling window. Sort of how a convolution would scan across the data and take the average but instead take the maximum/minimum/median/etc to get the desired curve. If these points under the curve occur at the same points that are above them you could also filter them out by finding the repeated x-axis points and use the maximum y values for the repeated points.
0 Comments
See Also
Categories
Find more on Fit Postprocessing 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!