Deleting certain data from a graph

8 views (last 30 days)
Jason
Jason on 13 May 2016
Answered: Jason on 13 May 2016
Hi. I have an image of a line that I want to measure its "sharpness". As a crude way, I thought I can just look at the green portion of the data and fit a straightline, using the gradient as my measure. So if my data takes the form x,y, how can I only keep the data such that the yvalue is inbetween say 30% of the max and 30% of the minimum. This will then allow me to perform a straight line fit and I can use the gradient as a crude form of "sharpness"
Thanks Jason

Accepted Answer

Jason
Jason on 13 May 2016
I've got this far:
mx=max(ydata(:))
mn=min(ydata(:))
ydata=ydata-mn;
mydata=[xdata',ydata']
%use logical indexing to remove data
TF1 = mydata(:,2)<=1.3*mn
TF2 = mydata(:,2)>=0.7*mx
%Combine
TFall = TF1 | TF2
% remove
mydata(TFall,:) = []
subplot(1,3,3)
plot(mydata(:,1),mydata(:,2),'r.','LineWidth',1)
But I have 2 lines, how can I fit both?

More Answers (0)

Categories

Find more on Line 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!