I dealing with data from an experiment and i need to find local equivalents or the points where slope is zero.
I tried it in the code as you can see in graph (the red circles), I could find a couple, but the rest dont have the slope exactly zero.
So anyone know if its possible to find the top point or the equivalents.
clcgogn = xlsread(fullfile('C:\Users\ebben\Dropbox\HR\Eðlisfræði\Verklegt\Top','TOP_gogn.xlsx'));angle = gogn(:,3); % Exstracting data from excel doc
time = gogn(:,4);scl = find(angle==min(angle));time = time(scl:numel(time)); % deleting data in beginning thats not important
angle = angle(scl:numel(angle));stilling = angle(numel(angle)); % Adjusting to fit x-axis = 0
angle = angle + abs(stilling);plot(time,angle,'Linewidth',1.5) % plotting and designing graph
xlabel('Time[sec]');ylabel('Angle[rad]');gridhold ondx_time1 = mean(diff(time)); % trying to find where slope is zero
dy_angle = gradient(angle,dx_time1);n=1;slope_angle = dy_angle(1)for i=1:numel(time) slope_angle = dy_angle(i); if slope_angle == 0 inti(n)=i; n=n+1; endendfor i=1:numel(vec) % for lykkja sem plottar upp punktana á graf
plot(time(vec(i)),angle(vec(i)),'rO','markersize',10) hold on end
Best Answer