Find specific points of increase within multiple different data sets
Show older comments
I am trying to write a function to identify the points as shown on this graph (not ones crossed with red).

However, I can't seem to get it to only identify the start and finish of the increase of data. Most of them are identifying points in between which are not wanted (but not at every point). This is what I have written so far:
function [Lpoints] = findpoints(Ldata)
%Calculate the point of abrupt changes in Ldata
Lchange = ischange(Ldata,'linear','Threshold',500);
%Find indices of changes
Lindices=find(Lchange);
%Calculate change in L between these indices
figure;
plot(Ldata);
xline(Lindices);
Lpoints=Lindices;
I have tried to exclude the central points by adding this (and adjusting the Ldiff>x parameter) to only get the start of the increase but this seems to eliminate the more subtle increases, and it would be preferred to get both points.
Lvalues = Ldata(Lindices);
Ldiff = [0; diff(Lvalues)];
number=Ldiff>40;
Ldiff(number)=NaN;
indices=~isnan(Ldiff);
Lindices2=Lindices(indices);
Lpoints=Lindices2
I have attached a selection of sample data, and it would be ideal to get something that works across the board. I may be taking the wrong approach, so any suggestions of how to go about this would be great!
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB 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!