MATLAB: Find edges in a plot

edgedetectionplot

I've been trying for a while to find the following edges on a graph as shown in the picture below
The following code is for the path and plot
path_test=[ 106 20;
107 19;
108 18;
109 17;
110 16;
111 15;
112 14;
113 13;
114 12;
114 11;
114 10;
115 9;
116 9;
117 9;
118 9;
119 9;
120 9;
121 9;
122 9;
123 9;
124 9;
125 9;
126 9;
127 9;
128 10;
129 10;
130 10];
plot(path_test(:,2),path_test(:,1),'b');
I've tried to use islocalmin and ischange as shown bellow
index1=islocalmin(path_test,'FlatSelection','first');
index2=islocalmin(path_test,'FlatSelection','last');
index3=ischange(path_test);
index = [index1 index2 index3];
path_index=[];
for i=1:length(index)
if (any(index(i,:))==1 && all(index(i,:))==0)
path_index = [path_index i];
end
end
figure(11)
plot(path_test(:,2),path_test(:,1),'b');
hold on
plot(path_test(path_index,2),path_test(path_index,1),'rX')
And to use all of these commands alone, but i only get the following points shown in the plot below
With only findlocalmin i get the following
I was woundering if anyone know about a way to find the points of interest?

Best Answer

Better solution
x = path_test(:,2);
y = path_test(:,1);
dangle = diff( diff(y)./diff(x) );
ind = find(abs(dangle) > 0.1)+1;
hold on
plot(x(ind),y(ind),'or')
hold off