forked from ldominguezruben/meanderstatisticstoolbox
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmStat_assignMaxCurv.m
31 lines (24 loc) · 1.17 KB
/
mStat_assignMaxCurv.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [maxCurvS, maxCurvXY] = mStat_assignMaxCurv(dimlessCurvature, delta, sResample, equallySpaced)
%This function found the maximum curvature using the peakdet function
%Dominguez Ruben L. UNL
% Use the peakdet function to get an index of the peaks and troughs
[maxtab, mintab]=peakdet(dimlessCurvature, delta, sResample);
% Create index
index1 = zeros(length(maxtab(:,1)),1);
index2 = zeros(length(mintab(:,1)),1);
for i = 1:length(maxtab(:,1))
index1(i) = find(sResample == maxtab(i,1));
end
for i= 1:length(mintab(:,1))
index2(i) = find(sResample == mintab(i,1));
end
index = [index1; index2];
index = sort(index);
%peakS = handles.sResample(index1);% s-ordinates of peaks.
%troughS = handles.sResample(index2);% s-ordinates of troughs.
% maxCurvX = handles.equallySpacedX(index);% x-ordinates of peaks and troughs.
% maxCurvY = handles.equallySpacedY(index);% y-ordinates of peaks and troughs.
maxCurvS = sResample(index); % s-ordinates of peaks and troughs.
maxCurvXY(:,1) = equallySpaced(index,1); %matrix with x,y coordinates of points of max curvature
maxCurvXY(:,2) = equallySpaced(index,2);
%Bend to bend analize the distance that the point to line