简体   繁体   中英

Specific Drop Point Algorithm - Matlab

I have developed a script that basically utilizes a bunch of hard coded functions to reduce my data and come up with plots for different variables in the form of data_#min like attached in the figure. Variables are named like that and then changed for the # of mins the trial lasted.

What I want to be able to do is identify the drop points of these plots which I point to by an arrow. There is a huge amount of change between points for example, about a -68% change from row 50,018 to 50,019. These drops which all seem to occur within rows (49000:51000) of a 100,000 row column number 6 (identified by the blue plotted line) occur within the data 10columns x 100000row array. They are setup in variables for example called data_10min.

So what I would like to find is the specific drop point shown in

    data_10MIN(49000:51000,6) 

data_10min is the variable, and then the parameters for how the graph is plotted is shown.

It would be cool to have something hardcode a function to automate and just easily find that point using hard code, the only issue is that each trial shifts left and right and they aren't consistent so different trials drop at different times (row numbers).

    findpeaks(data) 

this function offers a local min max type of analysis but I don't think it really has been working for my specific scenario. If someone can help me figure this issue out, and try to maybe come up with a first step it would really help me out. Thanks!

Picture of data_10Min drop point

If I interpret your description correctly, you are interested in the maxima of the curvature of your data.

For simplicity, I assume your data is equidistant and y is parametrized by x. Then define

x=data_10MIN(49000:51000,1);
y=data_10MIN(49000:51000,6);

dx = diff(x);
dydx = diff(y)./dx;
ddyddx = diff(dydx)./dx(1:end-1);
kappa = ddyddx./(1+dydx(1:end-1).^2).^1.5;
[~,locs] = findpeaks(kappa);
locs = locs+1; % index shifted because of diff

plot(x,y,'.-')
plot(x(locs),y(locs),'ro')

and findpeaks(kappa) will get you the positions on the curvature vector which correspond to the drops in the plot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM